pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brett W. McCoy <bmccoy@lan2wan.com>
To: MESZAROS Attila <tilla@chiara.csoma.elte.hu>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] compound key
Date: Fri, 19 Mar 1999 19:07:51 -0500 (EST)
Message-ID: <Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com> (raw)
In-Reply-To: <Pine.LNX.3.96.990319214553.24189A-100000@chiara.csoma.elte.hu>

On Fri, 19 Mar 1999, MESZAROS Attila wrote:

> I have seen the following stucture in AdabasD:
> create table AttributeNames (
>    id           integer not null,
>    name         varchar(200),
>    classId      integer not null
> );
> alter table AttributeNames add primary key (id,classId);
> 
> I know, I can't create "compound key" using "alter table", but is there
> any way to create one ?

CREATE UNIQUE INDEX AttributeNames_pkey
ON AttributeNames(id, classId);

Or even

create table AttributeNames (
    id           integer not null,
    name         varchar(200),
    classId      integer not null
    PRIMARY KEY(id, classId);	
 );     

Brett W. McCoy           
                                         http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
Labor, n.:
	One of the processes by which A acquires property for B.
		-- Ambrose Bierce, "The Devil's Dictionary"

----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GAT dpu s:-- a C++++ UL++++$ P+ L+++ E W++ N- o K- w--- O@ M-@ !V PS+++ 
PE Y+ PGP- t++ 5- X+ R+@ tv b+++ DI+++ D+ e>++ h+ r++ y++++
------ END GEEK CODE BLOCK ------




view thread (2+ messages)

Message-ID: <Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com>
Permalink:  ../Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com/
Also on:    postgresql.org/message-id/Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: bmccoy@lan2wan.com, tilla@chiara.csoma.elte.hu, pgsql-sql@hub.org
  Subject: Re: [SQL] compound key
  In-Reply-To: <Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com>
  References: <Pine.LNX.3.96.990319214553.24189A-100000@chiara.csoma.elte.hu> <Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox