pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
compound key
2+ messages / 2 participants
[nested] [flat]

* compound key
@ 1999-03-19 20:58  MESZAROS Attila <tilla@chiara.csoma.elte.hu>
  0 siblings, 1 reply; 2+ messages in thread

From: MESZAROS Attila @ 1999-03-19 20:58 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Hi,

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 ?

thanx,
Attila




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] compound key
@ 1999-03-20 00:07  Brett W. McCoy <bmccoy@lan2wan.com>
  parent: MESZAROS Attila <tilla@chiara.csoma.elte.hu>
  0 siblings, 0 replies; 2+ messages in thread

From: Brett W. McCoy @ 1999-03-20 00:07 UTC (permalink / raw)
  To: MESZAROS Attila <tilla@chiara.csoma.elte.hu>; +Cc: pgsql-sql@hub.org

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-03-20 00:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-03-19 20:58 compound key MESZAROS Attila <tilla@chiara.csoma.elte.hu>
1999-03-20 00:07 ` Brett W. McCoy <bmccoy@lan2wan.com>

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