Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BC426476F34 for ; Thu, 7 Nov 2002 09:33:15 -0500 (EST) Received: from matrix.gatewaynet.com (unknown [217.19.69.50]) by postgresql.org (Postfix) with ESMTP id 58EC947723D for ; Thu, 7 Nov 2002 09:23:13 -0500 (EST) Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.11.6/8.11.6) with ESMTP id gA7ESm007278; Thu, 7 Nov 2002 16:28:48 +0200 Date: Thu, 7 Nov 2002 16:28:48 +0200 (EET) From: Achilleus Mantzios To: Huub Cc: pgsql-sql@postgresql.org Subject: Re: primary keys In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/101 X-Sequence-Number: 10243 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@matrix.gatewaynet.com mantzios@softlab.ece.ntua.gr