Reputation: 539
I have two tables:
Person(personID, name, phone, email);
Relation(child_personID, parent_playerID);
The relationship table helps identify children and their parent but to do this the personID from the person table has to be referenced twice as foreign. How exactly would I go about doing this?
Upvotes: 1
Views: 6920
Reputation: 139010
Could look something like this.
create table Person
(
personID int primary key,
name varchar(50),
phone varchar(50),
email varchar(50)
)
create table Relation
(
child_personID int references Person(personID),
parent_playerID int references Person(personID),
primary key (child_personID, parent_playerID)
)
Upvotes: 2