Search Postgresql Archives

Re: brain-teaser with CONSTRAINT - any SQL experts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



on 10/8/05 11:36 PM, mileskeaton@xxxxxxxxx purportedly said:

> I know it's tempting to say, "just link a separate table for the book
> and don't store the book name" but let's just pretend that's not an
> option - because I'm not actually dealing with books : I just made up
> this simplified version of something at work, where we can't change
> the table : 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.

I would create a multi-column unique index on the table. This should solve
the problem mentioned although you may still have an integrity issue if a
"book" name is mistyped.

Best regards,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux