2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
7
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
8
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
20
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam;
21
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
22
delete from t1 where b=4;
23
insert into t1 values (NULL,5),(NULL,6);
39
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
40
show variables like "%auto_inc%";
42
auto_increment_increment 100
43
auto_increment_offset 10
44
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
45
insert into t1 values (NULL),(5),(NULL);
46
insert into t1 values (250),(NULL);
54
insert into t1 values (1000);
56
insert into t1 values(NULL),(NULL);
78
create table t1 (a int not null auto_increment, primary key (a)) engine=innodb;
79
insert into t1 values (NULL),(5),(NULL);
80
insert into t1 values (250),(NULL);
88
insert into t1 values (1000);
90
insert into t1 values(NULL),(NULL);
112
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
113
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
114
insert into t1 values (NULL),(5),(NULL),(NULL);
115
insert into t1 values (500),(NULL),(502),(NULL),(NULL);
128
insert into t1 values(600),(NULL),(NULL);
129
ERROR 23000: Duplicate entry '600' for key 'PRIMARY'
131
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
161
set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
162
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
163
insert into t1 values(2),(12),(22),(32),(42);
164
insert into t1 values (NULL),(NULL);
165
insert into t1 values (3),(NULL),(NULL);
186
create table t1 (a tinyint not null auto_increment primary key) engine=myisam;
187
insert into t1 values(103);
188
set auto_increment_increment=11;
189
set auto_increment_offset=4;
190
insert into t1 values(null);
191
insert into t1 values(null);
192
insert into t1 values(null);
193
ERROR 23000: Duplicate entry '125' for key 'PRIMARY'
194
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
195
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
199
create table t2 (a tinyint unsigned not null auto_increment primary key) engine=myisam;
200
set auto_increment_increment=10;
201
set auto_increment_offset=1;
203
insert into t2 values(null);
205
Warning 1264 Out of range value for column 'a' at row 1
206
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
207
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
209
create table t3 like t1;
210
set auto_increment_increment=1000;
211
set auto_increment_offset=700;
212
insert into t3 values(null);
214
Warning 1264 Out of range value for column 'a' at row 1
215
select * from t3 order by a;
218
select * from t1 order by a;
223
select * from t2 order by a;
226
select * from t3 order by a;