Re: design - Mailing list pgsql-general

From Roderick A. Anderson
Subject Re: design
Date
Msg-id Pine.LNX.4.10.10101301204030.2524-100000@tincan.org
Whole thread Raw
In response to design  (Jeff <jeff4e@rochester.rr.com>)
List pgsql-general
On Tue, 30 Jan 2001, Jeff wrote:

> I have a design question.  Lets say we want to keep track of users and
> their respective snail mail addresses.  Each user can have up to 4
> different mailing address.  Is it better to have all this information in
> one table.

Only if you have mostly 4 address users.  And then it questionable.

> Or is it better to have a user table and an address table,
> and have the user id as a foreign key in the address table?

Yes!  Though at first reading I thought you had your primary key and
foreign key reversed.

Primary key user_id (???) in the user table.

Foreign key references user(user_id) in the address table.

You might want to think of an ordering attribute (column) in the address
table so you can select a preferred address when only on is wanted.


Have a normalized day,
Rod
--



pgsql-general by date:

Previous
From: Nelio Alves Pereira Filho
Date:
Subject: Order of Rules
Next
From: adb
Date:
Subject: Re: Order of Rules