Thanks to visit codestin.com
Credit goes to postgrespro.com

Re: multiple primary keys and reference - Mailing list pgsql-sql

From Achilleus Mantzios
Subject Re: multiple primary keys and reference
Date
Msg-id [email protected]
Whole thread Raw
In response to multiple primary keys and reference  (Matt <[email protected]>)
List pgsql-sql
CREATE TABLE Parts(
PartNo varchar(20) NOT NULL,
machtypesid int4 NOT NULL,
BestPrice decimal(100,2),
Comment text,
PRIMARY KEY (PartNo,machtypesid));

CREATE TABLE MachDefs(
defid serial NOT NULL UNIQUE PRIMARY KEY,
Description text,
PartNo varchar(20),
MachTypeID int4 NOT NULL,
FOREIGN KEY (PartNo,MachTypeID) REFERENCES Parts (PartNo,machtypesid));

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  [email protected]       [email protected]



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Efficient DELETE Strategies
Next
From: Stephan Szabo
Date:
Subject: Re: multiple primary keys and reference