mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
64 lines
1.6 KiB
Text
64 lines
1.6 KiB
Text
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;
|