Re: brain-teaser with CONSTRAINT - any SQL experts? - Mailing list pgsql-general

From Oliver Elphick
Subject Re: brain-teaser with CONSTRAINT - any SQL experts?
Date
Msg-id 1128839091.6751.28.camel@linda.lfix.co.uk
Whole thread Raw
In response to brain-teaser with CONSTRAINT - any SQL experts?  (Miles Keaton <mileskeaton@gmail.com>)
Responses PostgreSQL missing in SuSE 10?  (Gregory Youngblood <pgcluster@netio.org>)
List pgsql-general
On Sat, 2005-10-08 at 22:36 -0700, Miles Keaton wrote:
> ... both isbn and name MUST be in the table, and what I'm
> trying to do is put a CONSTRAINT on the table definition to protect
> against user error, by making sure that any entered isbn is only tied
> to one book-name in that table.

Create a separate table with the two columns name and isbn which are
that table's primary key; on the main table, create a foreign key to the
new table.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html


pgsql-general by date:

Previous
From: "Uwe C. Schroeder"
Date:
Subject: Re: brain-teaser with CONSTRAINT - any SQL experts?
Next
From: Gregory Youngblood
Date:
Subject: PostgreSQL missing in SuSE 10?