create table A
(
ID int primary key
)
1. 直接在创建字段时添加引用
create table B
(
AID int references A(ID)
)
2. 创建完这个字段后再创建
create table B
(
AID int ,
foreign key(AID) references A(ID)
)
3.创建完表后单独创建
alter table B
add constraint fk_ax foreign key(AID) references A(ID)
921

被折叠的 条评论
为什么被折叠?



