| 1 |
create table t1 (c2 int as (1+1), c1 int primary key auto_increment) engine=innodb; |
| 2 |
insert into t1(c1) values (null),(null),(null); |
| 3 |
select * from t1; |
| 4 |
c2 c1 |
| 5 |
2 1 |
| 6 |
2 2 |
| 7 |
2 3 |
| 8 |
alter table t1 auto_increment = 3; |
| 9 |
show create table t1; |
| 10 |
Table Create Table |
| 11 |
t1 CREATE TABLE `t1` ( |
| 12 |
`c2` int(11) GENERATED ALWAYS AS (1 + 1) VIRTUAL, |
| 13 |
`c1` int(11) NOT NULL AUTO_INCREMENT, |
| 14 |
PRIMARY KEY (`c1`) |
| 15 |
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 16 |
drop table t1; |