Re: multiple primary keys and reference

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: multiple primary keys and reference
Дата
Msg-id 20020610085457.L67911-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на multiple primary keys and reference  (Matt <matthew.berardi@weilpublishing.com>)
Список pgsql-sql
On Fri, 7 Jun 2002, Matt wrote:

> I have a table, OrderDetail, with two primary keys OrderID and ProductID

I assume you mean it has a primary key with two columns.
>
> I want another table, Claims, to reference the primary keys of
> OrderDetail so that the pair has to match between table not just one
> attrib. I can't figure out how to do this from the docs I have. can
> anyone help? thankyou in advance

If I understand what you want, use the table constraint form of foreign
keys:

create table a (a int, b int, primary key(a,b));
create table b (a int, b int, foreign key(a,b) references a);




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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: multiple primary keys and reference
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: VIEWs and FOREIGN keys