Re: primary keys

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: Huub <v(dot)niekerk(at)freeler(dot)nl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: primary keys
Date: 2002-11-07 14:28:48
Message-ID: Pine.LNX.4.44.0211071626300.7264-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 6 Nov 2002, Huub wrote:

> Hi,
>
> I want to create a table which has 2 columns, and both columns have to
> be primary key (or: together they are the primary key). How can I do
> this using SQL? Using pgAdminII for Postgres7.2.2 on RH8.

I dont know the way in pgAdminII, but from psql simply give:

CREATE TABLE foo(
name varchar(20) NOT NULL,
id int4 NOT NULL,
PRIMARY KEY (name,id));

>
> Thanks
>
> Huub
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill(at)matrix(dot)gatewaynet(dot)com
mantzios(at)softlab(dot)ece(dot)ntua(dot)gr

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Huub 2002-11-07 14:29:35 Re: primary keys
Previous Message Achilleus Mantzios 2002-11-07 14:25:36 Re: how to get the source table & field name of a view field