Click here to Skip to main content
15,796,738 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
can we have one or more foreign key in one table.
Posted

Yes you can! But each foreign key constraint would go in its own field. A join-table is a good example of a table that, in most cases, only has foreign keys. This is how many-to-many relations are created (in relational database ).

Good luck!
 
Share this answer
 
yes.

see the following for examples:

http://www.w3schools.com/sql/sql_foreignkey.asp[^]

create table A
(
id int constraint PK_D primary key,
idb int constraint FK_D_IDB foreign key references B(id),
idc int constraint FK_D_IDC foreign key references C(id),
);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900