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

From: Casey Allen Shobe <cshobe(at)softhome(dot)net>
To: Peggy Go <shatz_go(at)yahoo(dot)com>, 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 15:35:54
Message-ID: 200312291035.54017.cshobe@softhome.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Bruno Wolff III (Sunday 28 December 2003 23:24)
> primary key (Region_Num, Num_Players)

You might also find unique () to be very helpful. I personally prefer to
always have an id column as the primary key in any table, and to further
constrain the table with unique's, where necessary.

create table foobar (
id bigint default nextval(foobar_seq),
foo varchar(32),
bar smallint,
foob text,
primary key (id),
unique (foo, bar)
);

Vertu sæll,

--
Sigþór Björn Jarðarson (Casey Allen Shobe)
http://rivyn.livejournal.com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Casey Allen Shobe 2003-12-29 17:09:01 Re: how to set more than two attributes as primary keys in a table
Previous Message Michael Fuhr 2003-12-29 04:30:45 Re: how to set more than two attributes as primary keys in a table