There are several approaches how to store entities hierarchy in relation database
For example there is person entity (20 basic attributes), student entity (the same as person but several new specific fields are present), employee (the same as person but some new fields are present) e.t.c.
When you advice to use (and not to use) the following data modeling approaches:
- One big table with all possible fields + personType marker field (student or employee)
- Table inheritance
- One Table with XML field (or maybe another data type) to store all the custom fields
- Something else but also relational…
Thank you in advance!
A database models facts, not objects, and each table should model a relatively self-contained set of facts. The consequence of this is that your tables should look something like this:
An additional consequence is that a student can also be an employee, which probably models real life closer than an inheritance graph would.