blob: 89beaa11a164d524a6bdecc097382ad95bb3c6b2 (
plain)
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
|
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (b1 BOOL <CUSTOM_COL_OPTIONS>,
b2 BOOLEAN <CUSTOM_COL_OPTIONS>
) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
b1 tinyint(1) # # #
b2 tinyint(1) # # #
INSERT INTO t1 VALUES (1,TRUE);
SELECT * FROM t1;
b1 b2
1 1
INSERT INTO t1 VALUES (FALSE,0);
SELECT * FROM t1;
b1 b2
0 0
1 1
INSERT INTO t1 VALUES (2,3);
SELECT * FROM t1;
b1 b2
0 0
1 1
2 3
INSERT INTO t1 VALUES (-1,-2);
SELECT * 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 * FROM t1 WHERE b1 = TRUE;
b1 b2
1 1
SELECT * FROM t1 WHERE b2 = FALSE;
b1 b2
0 0
INSERT INTO t1 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 * FROM t1;
b1 b2
-1 -2
0 0
0 0
1 1
2 3
INSERT INTO t1 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 * 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 t1 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 'ZEROFILL' at line 1
DROP TABLE t1;
|