Re: Primary Keys

From: "Thomas F(dot) O'Connell" <tfo(at)monsterlabs(dot)com>
To: pgsql-admin(at)postgresql(dot)org(dot)pgsql-general(at)postgresql(dot)org
Subject: Re: Primary Keys
Date: 2001-05-01 15:13:28
Message-ID: 3AEED298.2080804@monsterlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Brian Z wrote:

> How can you create a Primary Key which contains multiple columns on for a
> table.

first of all, i recommend checking out the syntax for the CREATE TABLE
command. it's available here:

http://postgresql.readysetnet.com/users-lounge/docs/7.1/postgres/sql-createtable.html

for a quick example, though:

create table foo (
bar int4,
baz int4,
ola int4,
primary key( bar, baz )
);

this statement will make the columns bar and baz coincidentally the
primary key for the table foo.

-tfo

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Brendan 2001-05-01 15:21:05 showing currently running queries
Previous Message Christian Anton 2001-05-01 04:09:44 URGENT HELP NEEDED

Browse pgsql-general by date

  From Date Subject
Next Message John Coers 2001-05-01 15:49:11 Re: Copy
Previous Message Lincoln Yeoh 2001-05-01 14:35:34 Re: Locking a database