Re: design

From: "Roderick A(dot) Anderson" <raanders(at)tincan(dot)org>
To: Jeff <jeff4e(at)rochester(dot)rr(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: design
Date: 2001-01-30 20:09:54
Message-ID: Pine.LNX.4.10.10101301204030.2524-100000@tincan.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
--

In response to

  • design at 2001-01-30 16:35:21 from Jeff

Browse pgsql-general by date

  From Date Subject
Next Message Nelio Alves Pereira Filho 2001-01-30 20:20:26 Order of Rules
Previous Message Fred Yankowski 2001-01-30 20:07:11 Re: Re: [GENERAL] Trouble porting postgreSQL to WinNT