0

I seem to be having an issue implementing a Schema which is direct from the Mysql website. I can't add the image as Stack overflow doesn't allow me to but have added link below to diagram.

Employee Table

Emp_No. INT(11) (Primary)

Dept_manager

Emp_No. INT(11) (Primary)

Dept_no. CHAR(4) (Primary)

Departments

Dept_no. CHAR(4) (Primary)

Dept_emp

Emp_No. INT(11) (Primary)

Dept_no. CHAR(4) (Primary)

https://dev.mysql.com/doc/employee/en/sakila-structure.html

The dept_emp and dept_manager are identical Junction tables, both with the same Primary keys set up.

The issue I seem to be running into is setting the foreign keys for both tables. MySql throws an error stating that the same foreign constraint exists. So this can be set for one table but not the other?

How do we handle Junction tables with potentially the same foreign key constraints?

1 Answers1

0

Ok,

So I assumed the Foreign Key had to match the Primary key from a naming convention point of view and hence why the error of duplication is thrown.

The link illustrates the naming conventions for foreign Keys Foreign Key naming scheme