I have to transpose a class Diagram into a Physical Data Model (more precisely MySQL database structure).
In my class diagram, I have a lot of entities (A, B, C, D) which inherit from an other entity, named PARENT.
PARENT entity have a relationship PARENT_OTHER of cardinality (0.* - 0.*) with an entity named OTHER.
I had thought of two methods :
- My first method is to use "Concrete Table Inheritance". I don't transposed the PARENT entity into a table but I have one concrete table for each children entities : T_A, T_B, T_C, T_D. However I must create the PARENT_OTHER relationship for each tables T_A, T_B, T_C, T_D.
Schema :
So, if I have N childrens entities, I have 2 * N Tables... (without the table T_OTHER).
- The second method is to conserve the inheritance (Class Table Inheritance).I have one table by children : T_A, T_B, T_C, T_D and one table for PARENT entity : T_PARENT.
Schema :
So, if I have N childrens entities, I have N + 2 Tables... (without the table T_OTHER).
Out of the number of tables, the second solution offer a bit more of abstraction... I can look directly in the table T_PARENT_OTHER for all children without joins.
Some people say me that I should avoid inheritance in RDBMS (Relational Database Management System), like MySQL DBMS, and I suppose that it's true.
I think this is common problem in database modelisation.
I would like to know what is the best way in this kind of situation ?
Are there other ways ?
Thanks in advance and please excuse my english.