I am using mysql. The business requirement is that every Employee
must be registered in a Department
. However, every Department
has to have one Manager
to manage the department. As you can see, a Manager
is an Employee
itself, so, I only have two tables here, Employee
and Department
.
In the Employee
table, I have a department
column as a foreign key that refer to the Department
table which I gave a NOT NULL
constraint as it's a total participation. In the Department
table, I have the manager
column which I also gave a NOT NULL
constraint as it's also a total participation.
The initial state of both tables are empty like usual however, now I can't insert data into the Employee
table as I need to fill the department
column which is impossible as the Department
table is still empty. Then, I went to fill the Department
table and it also doesn't work as the manager
column cannot be empty and there is no record in the Employee
table.
Help? :'(