1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk INT AUTO_INCREMENT PRIMARY KEY,
b1 BOOL ,
b2 BOOLEAN
) ENGINE=rocksdb;
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
pk int(11) NO PRI NULL auto_increment
b1 tinyint(1) YES NULL
b2 tinyint(1) YES NULL
INSERT INTO t1 (b1,b2) VALUES (1,TRUE);
SELECT b1,b2 FROM t1;
b1 b2
1 1
INSERT INTO t1 (b1,b2) VALUES (FALSE,0);
SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
INSERT INTO t1 (b1,b2) VALUES (2,3);
SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
2 3
INSERT INTO t1 (b1,b2) VALUES (-1,-2);
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
1 1
2 3
SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1;
a b
false false
true true
true true
true true
SELECT b1,b2 FROM t1 WHERE b1 = TRUE;
b1 b2
1 1
SELECT b1,b2 FROM t1 WHERE b2 = FALSE;
b1 b2
0 0
INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
0 0
1 1
2 3
INSERT INTO t1 (b1,b2) VALUES (128,-129);
Warnings:
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b2' at row 1
SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
0 0
1 1
127 -128
2 3
ALTER TABLE t1 ADD COLUMN b3 BOOLEAN UNSIGNED ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED' at line 1
ALTER TABLE ADD COLUMN b3 BOOL ZEROFILL ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ADD COLUMN b3 BOOL ZEROFILL' at line 1
DROP TABLE t1;
|