Re: check constraint on multiple tables?

From: "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com>
To: Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: check constraint on multiple tables?
Date: 2010-03-03 16:29:44
Message-ID: A434C531E37AD442815608A769550D805941EBA9BA@EGEXCMB01.oww.root.lcl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Louis,
Interesting discussion. Always fun to think about real world stuff.

We have a similar problem for comparing hotel rooms.
So the issue is that you aren't originating the data, just classifying it.
I'd move toward a scheme where you reclassify the line marketing speak to common lay terms. You're trying to help consumers compare. Exactly what the marketers don't want them to do.

After all a silk purse is just a sow's ear without marketing.
:)
Doug

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Louis-David Mitterrand
Sent: Wednesday, March 03, 2010 10:18 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] check constraint on multiple tables?

On Wed, Mar 03, 2010 at 04:05:43PM -0000, Oliveiros wrote:
>
> As your table names seem to imply, type and category are cabin's
> characteristics , not ship characteristics.
> Am I right?

Yes and no :)

- I'm scanning cruise line web sites with a spider to collect prices so
I'm building cabin_type's and cabin_category's on the fly,
- each ship class (a cruise line has several) has its own particular
types (Celebrity Xpedition is the only one with "Xpedition suite"
type, etc.)

> As Richard pointed out, maybe you could add a relationship between
> cabin and ship and drop the relationship between ship and
> cabin_category you now have
> Then you could add that uniqueness restriction.

That's one option.

> Also, the relationship between type and category is one to many ? Or
> can it be many to many? Put other way, is this overlap between the
> categories that belong to different "types" ?

One cabin_type to many cabin_category's, for example:

- "Sunset Veranda Stateroom" (type) can be on "Vista", "Panorama", etc.
decks (category) with a different price,

But it's true that there is some overlap in categories between different
ships.

> If the later applies, maybe
> you could have cabin refer to both type and category tables and drop
> the relation between type and category.
>
> The cabin table would then work as an associative table between
> category and type.
>
> Ain't saying your schema is wrong, maybe you have strong reasons to
> do that that way, that I am not realizin by now...

You got me thinking about it. Thank you for your interesting comments.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Louis-David Mitterrand 2010-03-03 16:38:52 Re: check constraint on multiple tables?
Previous Message Louis-David Mitterrand 2010-03-03 16:21:19 Re: check constraint on multiple tables?