Integrity constraint issue in an inheritance relational model with MySQL 5.5
-
30-10-2019 - |
문제
I have the following database relational schema that purports to model an EMP supertype together with two FULL_TIME_EMP and PART_TIME_EMP subtypes:
The problem I have is one of integrity i.e. I would like to make sure that a full-time employee can only have a corresponding row in the FULL_TIME_EMP table and similarly a part-time employee can only have a correponding row in the PART_TIME_EMP table.
As you will see from the screen captures below, this integrity constraint is not enforced.
Here is the EMP_TYPE table:
And the EMP table:
The PART_TIME_EMP table:
And finally the FULL_TIME_EMP table which presents the integrity violation!!
Is there a way to enforce this integrity constraint by altering my database model design or do I have to resort to triggers?
Regards,
올바른 솔루션이 없습니다