Re: foreing key .. reference..
От
Andrew McMillan
Тема
Re: foreing key .. reference..
Дата
Msg-id
1045902210.4043.2666.camel@kant.mcmillan.net.nz
Ответ на
foreing key .. reference.. (Andres Ledesma)
Список
Дерево обсуждения
foreing key .. reference.. Andres Ledesma <aledes@telefonica.net>
Re: foreing key .. reference.. Andrew McMillan <andrew@catalyst.net.nz>
Re: foreing key .. reference..thanks a lot ... Andres Ledesma <aledes@telefonica.net>
postmaster does not shut down Jeff Deroshia <jeff@hal.physast.uga.edu>
Re: postmaster does not shut down Tom Lane <tgl@sss.pgh.pa.us>
On Sat, 2003-02-22 at 12:13, Andres Ledesma wrote:
> Hi evbody...
>
> Could anybody give me an example of foreing key ..references example ?
Here is an example from one of our applications.
Regards,
Andrew.
---------------------------
-- Contact Details
---------------------------
CREATE TABLE contact (
contact_id INT4,
name TEXT,
address1 TEXT,
address2 TEXT,
city TEXT,
state TEXT,
country TEXT,
postcode TEXT,
phone TEXT, -- format is "+
() "
fax TEXT, -- format is "+
() "
email TEXT,
PRIMARY KEY ( contact_id )
);
---------------------------
-- Registrar Details
---------------------------
CREATE TABLE registrar (
registrar_id INT4,
p_contactid INT4,
d_contactid INT4,
s_contactid INT4,
registrar_name TEXT,
commenced TIMESTAMP,
PRIMARY KEY ( registrar_id ),
CONSTRAINT p_contact_of_contact FOREIGN KEY ( p_contactid ) REFERENCES
contact,
CONSTRAINT d_contact_of_contact FOREIGN KEY ( d_contactid ) REFERENCES
contact,
CONSTRAINT s_contact_of_contact FOREIGN KEY ( s_contactid ) REFERENCES
contact
);
--
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Survey for nothing with http://survey.net.nz/
---------------------------------------------------------------------
В списке pgsql-novice по дате отправления