Re: primary key question - Mailing list pgsql-general

From Richard Huxton
Subject Re: primary key question
Date
Msg-id 200211071019.58381.dev@archonet.com
Whole thread Raw
In response to primary key question  (Huub <v.niekerk@freeler.nl>)
List 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

pgsql-general by date:

Previous
From: Lee Kindness
Date:
Subject: Re: replace text function
Next
From: 史绪良
Date:
Subject: Q!