drop table father;
create table father(
id int identity(1,1) primary key,
name varchar(20) not null,
age int not null
)
drop table mother;
create table mother(
id int identity(1,1),
name varchar(20) not null,
age int not null,
husband int not null
)
alter table mother
add constraint FK_ID foreign key(husband) references father(id)
如果 在father中没能定义主键,
drop table father;
create table father(
id int identity(1,1), (未定义 primary key)
name varchar(20) not null,
age int not null
)
则会报如下异常: