Home Forums SQL Server 2005 T-SQL (SS2K5) Database Design question regarding Normalized Tables RE: Database Design question regarding Normalized Tables

  • Steven Willis (2/3/2013)


    Considering something like Contact Info I'd do something like below. . . . .

    I'll say again: this is a very simplified model. What actually needs to go in the various tables is always based on the needs of the application.

    . . .

    --All of these tables allow for adding a new 'type' at any time or changing the description of a 'type'

    Table:AddressType

    AddressTypeID

    AddressType -- shipping, mailing, home, office, vacation house, etc

    AddressTypeDesc --optional for allowing longer descriptions

    --Could be Customer, Agent, Relative, etc

    Table:ContactType

    ContactTypeID

    ContactType

    ContactTypeDesc

    Table:PhoneType

    PhoneTypeID

    PhoneType --home, cell, office, fax, etc

    PhoneTypeDesc

    . . . .

    --I like to use a cross-reference table because you can sometimes have more than 1 contact at the same address

    --as well as multiple addresses per contact

    Table:ContactAddress

    ContactID

    AddressID

    --For the same reason as addresses

    Table:ContactPhone

    ContactID

    PhoneID

    Lots of great stuff here. I would suggest that what's called a "cross-reference" table is really an "associative" table to relate entities (client to address, client to phone). Another good value of associative tables, besides allowing multiple clients (family members, for instance) to share an address or phone, is to define the nature of the relationship itself. So, for the Client-To-Address association, you'd have a column to distinguish perhaps Home from Work or Mail. This may, in fact, be what was intended by the various "Type" columns; if an address is shared by two clients, it could be home for one but just mail for another (think college student and parent, perhaps), so you'd want the type specified in the association.