1

This might be a silly question. But can you have the following:

1 Table with Primary Key, 2 different tables each with a foreign key referencing the first table Primary key?

I know its possible to have 2 foreign keys in the same table, but the request I received was for the the below scenario:

enter image description here

1
  • 1
    It is absolutely common situation.
    – Akina
    Jan 29, 2019 at 8:05

1 Answer 1

2

Why shouldn't it be possible? Suppose table1 holds all countries, table2 all cities and table3 has another foreign key to a table with all international organisations. They both need a foreign key to a country. You can even have a table4 that holds all regions. It also needs a foreign key to table1.

2
  • I kept on receiving error, dropped and recreated table with FK constraint and it went through. Like i said, silly question, But thanks for clarifying Jan 29, 2019 at 8:37
  • 1
    There are no silly questions. Only silly answers :-)
    – Marco
    Jan 29, 2019 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.