I need to store a set of entities, of which there are several specialized versions. They have some common properties, but the specialized ones contain properties specific fo
This technique can have some issues with proper design and performance, but you seem to need a compromise with flexibility.
Instead of having to create specific tables or even a new field for each property you could have a table (And it will be quite large) for unique properties:
Unique_Property_ID
, FK_To_Some_Entity (Not sure what entity these link to: customers, bills, etc.)
, Property_Type Not the data type but a link to a table describing this entity)
, Property_Value (Difficult to determine if all of your values will be of the same type: string, int, date, etc.)
Example: A used car dealership needing to track add ons for different makes and models (They never know what they're going to get). A few records may look like:
VehicleID Property Type Property Value
3 Sound System Bose
3 Hybrid System Battery
7 Starter Type Hand Crank
7 Passenger Seat Rumble
9 Starter Type Kick Start
9 Passenger Seat Side Car
Each value for each Set | property type would have its own record.
Another problem is when you do want each property to be represented as a column, you'll need to transpose this table.