| From: | Michael Fuhr <mike(at)fuhr(dot)org> |
|---|---|
| To: | Peggy Go <shatz_go(at)yahoo(dot)com> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: how to set more than two attributes as primary keys in a table |
| Date: | 2003-12-29 04:30:45 |
| Message-ID: | 20031228213045.A22597@quality.qadas.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Casey Allen Shobe | 2003-12-29 15:35:54 | Re: how to set more than two attributes as primary keys in a table |
| Previous Message | Bruno Wolff III | 2003-12-29 04:24:27 | Re: how to set more than two attributes as primary keys in a table |