Create table scripts:
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)
)
I looked at this but it doesn't help me.
Card table has primary key