I have to implement an EER diagram where there is a table called Person
. Two subclasses of that Person
table are Customer
and Employee
. I can visualize when it comes to a diagram, but now I'm trying to implement it in SQL Server.
My question is: do I have to create two tables or three?
In case of three tables, would I create a Person
table and then somehow reference it in the two tables called Customer
and Employee
? If so, could you provide an example in SQL form?
Or would I create two tables (Customer
and Employee
) and the fact that both of them are subclasses of Person
are just in the mind of the DB admin.
In my EERD, the Person
table has an attribute called IsEmployee
(which is a bool). Would this attribute be in both tables (Customer
and Employee
) if indeed I have to make two tables. There is also a 'manages' attribute pertaining to the Employee
table.
Thank you for your time! Here is a screenshot of the tables: