Re: [SQL] compound key

From: "Brett W(dot) McCoy" <bmccoy(at)lan2wan(dot)com>
To: MESZAROS Attila <tilla(at)chiara(dot)csoma(dot)elte(dot)hu>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] compound key
Date: 1999-03-20 00:07:51
Message-ID: Pine.BSI.3.91.990319190204.8303L-100000@access1.lan2wan.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 ------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Atika 1999-03-20 11:38:20 string containing (')
Previous Message Ismail Kizir 1999-03-19 21:28:31