日期:2014-05-18 浏览次数:20559 次
create table a( aid varchar(10) primary key, shuxing_a varchar(10) ) create table b( bid varchar(10) primary key, shuxing_b varchar(10) ) create table a_b( aid varchar(10) foreign key references a(aid) , bid varchar(10) foreign key references b(bid), ) --插入数据: insert into a values('01', 'aa') insert into a values('02', 'bb') insert into a values('03', 'cc') insert into b values('10', 'dd') insert into b values('20', 'ee') insert into b values('30', 'ff') insert into a_b values('01', '10') insert into a_b values('02', '20') insert into a_b values('02', '30')
create table a_b( aid varchar(10) constraint [fk_a_b_aid] foreign key references a(aid) on delete cascade, bid varchar(10) constraint [fk_a_b_bid] foreign key references b(bid) on delete cascade )