数据库里的外码为什么能取空值?什么情况下取空值?

来源:百度知道 编辑:UC知道 时间:2024/09/21 15:47:33
我刚接触数据库,对你所编的程序有点看不懂,能不能用语言描述得更详细一点呢?

和外码对应的主表的键唯一但可以为空就可以了
create table aa
(
a int not null primary key,
b int unique
)
create table bb
(
c int not null primary key,
d int,
constraint aa_bb_fk foreign key(d) references aa(a)
)
你运行这个教本试试看就知道了。但是我不保证写对