Re: design

Поиск
Список
Период
Сортировка
От Roderick A. Anderson
Тема Re: design
Дата
Msg-id Pine.LNX.4.10.10101301204030.2524-100000@tincan.org
обсуждение исходный текст
Ответ на design  (Jeff <jeff4e@rochester.rr.com>)
Список 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 по дате отправления:

Предыдущее
От: Nelio Alves Pereira Filho
Дата:
Сообщение: Order of Rules
Следующее
От: adb
Дата:
Сообщение: Re: Order of Rules