create table p(id int primary key,val int)
create table f(id int, constraint fkk foreign key (id) references p(id))
insert into f values(null)
drop table p
drop table f
create table f(id int, constraint fkk foreign key (id) references p(id))
insert into f values(null)
drop table p
drop table f
create table p(id1 int,id2 int,constraint p12 primary key(id1,id2))
create table f(id1 int,id2 int,constraint f12 foreign key(id1,id2) references p(id1,id2))
insert into f values(1,null)
两次插入都成功,当外键约束遇见NULL的时候会失效,需要特别注意。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/2281175/viewspace-742875/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/2281175/viewspace-742875/