Re: how to set more than two attributes as primary keys in a table

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: how to set more than two attributes as primary keys in a table
Дата
Msg-id 20031228213045.A22597@quality.qadas.com
обсуждение исходный текст
Ответ на how to set more than two attributes as primary keys in a table  (Peggy Go <shatz_go@yahoo.com>)
Список pgsql-novice
On Sun, Dec 28, 2003 at 08:21:32PM -0800, Peggy Go wrote:
>
> Normally, there is only one attribute for the primary
> key but in my table, my primary key is composed of two
> attributes. How do I state this in SQL? What if
> Region_num and Num_Players, combined, should form a
> primary key?
>
> CREATE TABLE REGION (
>   Region_Num    smallint primary key,
>   Num_Players    smallint,
>   Player_Num    smallint
> );

See the documentation for primary keys and for CREATE TABLE:

http://www.postgresql.org/docs/current/static/ddl-constraints.html#AEN1972
http://www.postgresql.org/docs/current/static/sql-createtable.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: how to set more than two attributes as primary keys in a table
Следующее
От: Casey Allen Shobe
Дата:
Сообщение: Re: how to set more than two attributes as primary keys in a table