views:

270

answers:

1

Sorry if this is too simple, but I've found a lot of documentation on ER-modeling recently, but all of it seems to skip over the actual implementation and I just want to clarify.

Is a subtype just a second table with a foreign key to the supertype along with the properties belonging to the subtype? This is what would make most sense to me, anyhow. The primary key of the subtype would typically be shared with the supertype also (primary of subtype has foreign constraint on supertype)?

+1  A: 

Yes, that's one of the three ways of doing it.

The second way, and perhaps the most simiple, is to just have the values in the subtype be fields in the supertype that can be null. It takes requires more space, but increases performance as it requires fewer queries to get the subtype-specific data.

The third way is to have a table for each type/subtype. This is efficient only if you always know the type/subtype of data you need to look up. It also doesn't require as much space as the second way.

BernzSed

related questions