列子: create table a (id int not null AUTO_INCREMENT, name char(10) not null, primary key(id) ); create table b (mid int not null references a , sex char(10) not null);insert into a values(NULL, 'aaa'); insert into a values(NULL, 'bbb'); insert into a values(NULL, 'ccc');insert into b values(1, 'man'); insert into b values(2, 'man'); insert into b values(last_insert_id(), 'man');
create table a (id int not null AUTO_INCREMENT, name char(10) not null, primary key(id) );
create table b (mid int not null references a , sex char(10) not null);insert into a values(NULL, 'aaa');
insert into a values(NULL, 'bbb');
insert into a values(NULL, 'ccc');insert into b values(1, 'man');
insert into b values(2, 'man');
insert into b values(last_insert_id(), 'man');