0

I am working on a school project. I have a table of employees with a given employee ID. The employee ID on this table is the primary key. I have already set the employee ID as a foreign key on another table, and I am trying to use it as a foreign key on another table as well. How can I do this? I am currently getting an error message saying "duplicate foreign key". Thanks!

  • *Duplicate foreign key" means that that exact foreign key between those columns on those two tables already exists. So you're definitely doing something wrong. Please show us the DDL you are using -- edit your question to show this, don't reply with a new comment. – Colin 't Hart Apr 27 at 7:45
2

I suspect you are linking the tables backwards. You can most definitely have multiple tables' FK point to the same table's PK. The FK is defined on the table doing the pointing, not the table being pointed at.

| improve this answer | |

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