Re: Database Design

From: Leandro Guimarães Faria Corsetti Dutra <leandrod_at_mac.com>
Date: Sun, 16 Sep 2001 15:44:59 -0300
Message-ID: <3BA4F32B.6060901_at_mac.com>


H wrote:

>
> however i have a new problem now, which is if jack has more
> than one email address that means i should make all three columns part
> of the primary key so that i could insert
>
> jack | email | jack_at_a.com
> jack | email | jack_at_b.com
>
> this seems kind of weird to me. If anyone has some advice on how
> to design a database like this please let me know.

        No one does it that way. Why not just adding a column?

        In fact, you are asking for headaches because you are trying to take over the RDBMS's schema role. For example, in Oracle there's a data dictionary derived relation (view) called DBA_TAB_COLUMNS which has the OWNER, TABLE, and COLUMN attributes; the table itself holds the values. Much more flexible and straightfoward.

        In fact your design should be a relation for customer, and other for email addresses with a foreign key to customer; or if you want to record that some families sometimes share an email address you could have an associative entity between them, as a customer-email_address relationship between customer and email address with foreign keys both to customer and to email address.

-- 
  _
/ \ Leandro Guimarães Faria Corsetti Dutra           +55 (11) 246 96 07
\ / http://geocities.com./lgdutra/       BRASIL      +55 (43) 322 89 71
  X  http://tutoriald.sourceforge.net./     mailto:lgcdutra_at_terra.com.br
/ \ Campanha fita ASCII, contra correio HTML    mailto:leandrod_at_mac.com
Received on Sun Sep 16 2001 - 20:44:59 CEST

Original text of this message