Re: primary key question

From: Richard Huxton <dev(at)archonet(dot)com>
To: Huub <v(dot)niekerk(at)freeler(dot)nl>, pgsql-general(at)postgresql(dot)org
Subject: Re: primary key question
Date: 2002-11-07 10:19:57
Message-ID: 200211071019.58381.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 07 Nov 2002 6:57 am, Huub wrote:
> Hi,
>
> Reading the online manual it doesn't get clear to me: can I or can't I
> define a primary key containing 2 columns, e.g. like:
>
> create table <name> (column1 char(10) not null, column2 char(20) not
> null, primary key (column1, column2))

Yes you can. The place to check this sort of information is in the SQL
Commands reference section of the manuals.

From CREATE TABLE:
"The primary key constraint specifies that a column or columns of a table may
contain only unique (non-duplicate), non-NULL values. "

You might also find the functional and partial indexing features of interest.

--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oskar Berggren 2002-11-07 14:13:00 Re: Q!
Previous Message Hervé Piedvache 2002-11-07 09:38:18 Failed to initialize lc_messages 7.3b5