~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test of auto_increment
3
#
4
# run this program with mysql -vvf test < this file
5
6
drop table if exists auto_incr_test,auto_incr_test2 ;
7
8
create table auto_incr_test (id int not null auto_increment, name char(40), timestamp timestamp, primary key (id)) ;
9
10
insert into auto_incr_test (name) values ("first record");
11
insert into auto_incr_test values (last_insert_id()+1,"second record",null);
12
insert into auto_incr_test (id,name) values (10,"tenth record");
13
insert into auto_incr_test values (0,"eleventh record",null);
14
insert into auto_incr_test values (last_insert_id()+1,"12","1997-01-01");
15
insert into auto_incr_test values (12,"this will not work",NULL);
16
replace into auto_incr_test values (12,"twelfth record",NULL);
17
18
select * from auto_incr_test ;
19
20
create table auto_incr_test2 (id int not null auto_increment, name char(40), primary key (id)) ;
21
insert into auto_incr_test2 select NULL,name from auto_incr_test;
22
insert into auto_incr_test2 select id,name from auto_incr_test;
23
replace into auto_incr_test2 select id,name from auto_incr_test;
24
25
select * from auto_incr_test2 ;
26
27
drop table auto_incr_test,auto_incr_test2;