I have 4 tables (Guardian, Child, Branch and ChildBranch).
Child is weak to Guardian. ChildBranch is the weak associative entity of Child and Branch.
They all have primary keys and data.
Guardian Primary Key : Email (PK, FK, varChar(100), not null)
Child Primary Key : Email (PK, FK, varChar(100), not null)
FirstName (PK, varChar(50), not null)
ChildBranch Primary Key : Email (PK, FK, varChar(100), not null)
FirstName (PK, varChar(50), not null)
Name (PK, varchar(50), not null)
How do I create the foreign key between Child and ChildBranch?
I tried:
ALTER TABLE ChildBranch
ADD FOREIGN KEY (Email)
REFERENCES Child(Email);
But got this error
There are no primary or candidate keys in the referenced table 'Child' that match the referencing column list in the foreign key 'FK__ChildBran__Email__7B5B524B'.
I expect to create the link between the Child and ChildBranch tables.