~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to tests/auto_increment.tst

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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;