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
|
CREATE TABLE t1 (
y YEAR NULL,
i SMALLINT NULL,
c VARCHAR(8) NOT NULL DEFAULT '',
vi SMALLINT AS (i) VIRTUAL,
INDEX(y)
) ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`i` smallint(6) DEFAULT NULL,
`c` varchar(8) NOT NULL DEFAULT '',
`vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL,
KEY `y` (`y`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
y i c vi
INSERT INTO t1 (i) VALUES (1),(2);
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
y i c vi
DROP TABLE t1;
CREATE TABLE t1 (
y YEAR NULL,
i SMALLINT NULL,
vi SMALLINT AS (i) VIRTUAL,
INDEX(y)
) ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`i` smallint(6) DEFAULT NULL,
`vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL,
KEY `y` (`y`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
y i vi
INSERT INTO t1 (i) VALUES (1),(2);
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
y i vi
DROP TABLE t1;
CREATE TABLE t1 (
y YEAR NULL,
i SMALLINT NULL,
b BLOB NULL,
vi SMALLINT AS (i) VIRTUAL,
INDEX(y)
) ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`i` smallint(6) DEFAULT NULL,
`b` blob DEFAULT NULL,
`vi` smallint(6) GENERATED ALWAYS AS (`i`) VIRTUAL,
KEY `y` (`y`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
y i b vi
INSERT INTO t1 (i) VALUES (1),(2);
SELECT * FROM t1 WHERE y BETWEEN 2012 AND 2016 FOR UPDATE;
y i b vi
DROP TABLE t1;
|