Re: check constraint on multiple tables?

Поиск
Список
Период
Сортировка
От Little, Douglas
Тема Re: check constraint on multiple tables?
Дата
Msg-id A434C531E37AD442815608A769550D805941EBA9BA@EGEXCMB01.oww.root.lcl
обсуждение исходный текст
Ответ на Re: check constraint on multiple tables?  (Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>)
Ответы Re: check constraint on multiple tables?  (Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>)
Список 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
consumerscompare.  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@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Louis-David Mitterrand
Sent: Wednesday, March 03, 2010 10:18 AM
To: pgsql-sql@postgresql.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
onthe fly, 
- each ship class (a cruise line has several) has its own particular types (Celebrity Xpedition is the only one with
"Xpeditionsuite" 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.

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


В списке pgsql-sql по дате отправления:

Предыдущее
От: Louis-David Mitterrand
Дата:
Сообщение: Re: check constraint on multiple tables?
Следующее
От: Louis-David Mitterrand
Дата:
Сообщение: Re: check constraint on multiple tables?