|
Posted by Steve Jorgensen on 10/18/05 18:43
On 18 Oct 2005 08:03:59 -0700, wackyphill@yahoo.com wrote:
>If you have several entities that have many common properties but a few
>have a few unique fields to them how do you design your tables?
>
>DO you make a seperate table for each entity even though they have many
>common fields or is there a way to do an OO type thing where you have a
>common table for all and somehow tack on the unique fields?
>
>Just unsure whats possible and what's best.
>
>Thanks for any input.
The standard way I've always seen and often do is to have a "base" table with
the common fields, and a 1-to-1 relationship to tables with fields for the
specific case. There's even a symbol for this used on database diagrams.
Here's an example
address
address_id
country
country_subdivision
city
postal_code
street_address
address_id
street_name
street_number
postal_address
address_id
postal_box
Every address has an "address", and every address will have either a
"street_address" or a "postal_address", but not both.
Navigation:
[Reply to this message]
|