Reputation: 9702
As seen in the following DB design:
Table2
has a typeTable2
belong to say, type oneTable2
are linked to Table1
using table1_id
Table2
and Table1
based on table1_id
Table2
, regardless the type, need the same columns (attrib1, attrib2
and table3_id
), I feel forced to leave those columns nullable while all other records that belong to other types will get their values insertedI narrowed my options down to:
Table1
Table2
, according to the type, into smaller tables, but the problem here is that I need a unique id
for each record regardless its type; therefore, splitting Table2
would mean that some of the records in all these tables would have identical ids since those ids would be incrementally seeded, just like table2_id
column currently is.Both Table2
and Table1
are linked to Table3
for the sake of data integrity and so are attribute1
and 2 to other tables but omitted here for the sake of simplifying
Should I stick to this design since I could easily filter Table2
by type_id
?
What is a better more robust approach to this dilemma?
Upvotes: 0
Views: 78