Re: How to represent a total-and-exclusive relation into a relational database

From: Mathieu Pagé <informatique_remove_this__at_csfinc.com>
Date: Wed, 19 Jan 2005 17:04:04 GMT
Message-ID: <8qwHd.36322$06.30996_at_clgrps12>


-CELKO- a écrit :
> The classic scenario calls for a root class with all the common
> attributes and then specialized sub-classes under it. As an example,
> let's take the class of Vehicles and find an industry standard
> identifier (VIN), and add two mutually exclusive sub-classes, Sport
> utility vehicles and sedans ('SUV', 'SED').
>
> CREATE TABLE Vehicles
> (vin CHAR(17) NOT NULL PRIMARY KEY,
> vehicle_type CHAR(3) NOT NULL
> CHECK(vehicle_type IN ('SUV', 'SED')),
> UNIQUE (vin, vehicle_type),
> ..);

Hi CELKO,

I'm trying to implement you model into mine and I think (And I would like to hear you opinion) that the UNIQUE clause above is useless since 'vin' is our primary key, I can not see how we could get any vin-vehicle-type pair that are not unique.

did I miss something ?

Mathieu Pagé Received on Wed Jan 19 2005 - 18:04:04 CET

Original text of this message