Reputation: 309
If a table has multiple foreign keys which reference same attribute of another table, how should be it written?
foreign key(A,B) references table_name(C)
or,
foreign key(A,B) references table_name(C,C)
here, A,B,C are attributes.
Upvotes: 0
Views: 1913
Reputation: 1507
No you should create two foreign keys referencing the same primary key. As follows:
foreign key(A) references table_name(C)
foreign key(B) references table_name(C)
Upvotes: 0
Reputation: 1269813
It is written as two foreign key references:
foreign key (A) references table_name(C),
foreign key (B) references table_name(C),
That is, each foreign key reference is defined using its own clause.
Upvotes: 1