创建表脚本:
Create Table [Card]
(
GiveDate Date not null,
PN nvarchar(50) not null,
FOREIGN KEY (PN) REFERENCES Patient (PN),
PRIMARY KEY (GiveDate,PN)
)
Create table [Registration]
(
EntryDate Date not null,
ExitDate Date,
RoomId int not null,
CardGiveDate date not null,
PN nvarchar(50) not null,
PRIMARY KEY (PN, EntryDate, CardGiveDate),
FOREIGN KEY (PN, CardGiveDate) REFERENCES [Card](PN, GiveDate)
)
我看着这个,但它对我没有帮助。
卡表有主键