Re: how to set more than two attributes as primary keys in a table - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: how to set more than two attributes as primary keys in a table
Date
Msg-id 20031228213045.A22597@quality.qadas.com
Whole thread Raw
In response to how to set more than two attributes as primary keys in a table  (Peggy Go <shatz_go@yahoo.com>)
List 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 by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: how to set more than two attributes as primary keys in a table
Next
From: Casey Allen Shobe
Date:
Subject: Re: how to set more than two attributes as primary keys in a table