create table t_auto (id int(4) unsigned zerofill not null auto_increment primary key, num int not null); insert into t_auto(num) values (10),(333),(344); select * from t_auto; 结果: query result(3 records) id num 0001 10 0002 333 0003 344
如果要间隔为2的话,就只能set global auto_increment_increment =2;
create table t_auto (id int(4) unsigned zerofill not null auto_increment primary key, num int not null);
insert into t_auto(num) values (10),(333),(344);
select * from t_auto;
结果:
query result(3 records)
id num
0001 10
0002 333
0003 344