Re: two primairy key in one table ?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: two primairy key in one table ?
Дата
Msg-id 20020707221726.A22659-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: two primairy key in one table ?  (Curt Sampson <cjs@cynic.net>)
Список pgsql-general
On Mon, 8 Jul 2002, Curt Sampson wrote:

> On Fri, 5 Jul 2002, Stephan Szabo wrote:
>
> > On Thu, 4 Jul 2002, Angela Luyf wrote:
> >
> > > I have a database model where a many to many relation is used, so i need
> > > to create a table with two primary key.
> >
> > You can't have multiple primary keys in a table (per SQL spec) but are
> > you sure that's what you want as opposed to a single key made of two
> > columns?
>
> I certainly read this as "two primary keys" in the sense of "two
> candidate keys," and I was quite suprised that everybody else
> interpreted this as "one primary key consisting of data from two
> columns."
>
> However, I don't see any problem here at all. That's because,
> relationally speaking, I am of the opinion that the concept of a PRIMARY
> KEY is entirely useless. If you've got two candidate keys on a table,
> and unique constraints on both of them, there's nothing at all that
> makes one better than the other.

True, but, trying to use two separate candidate keys on each of the
linking columns alone won't really make a many to many relationship.
I'm assuming that the linkage is what is supposed to be unique here
not the individual parts.





В списке pgsql-general по дате отправления:

Предыдущее
От: Ron Snyder
Дата:
Сообщение: Re: I am being interviewed by OReilly
Следующее
От: Justin Clift
Дата:
Сообщение: Re: I am being interviewed by OReilly