Re: Unique Keys
From: strider5 <strider5_at_szm.com>
Date: 25 Nov 2004 10:04:32 -0800
Message-ID: <1101405872.089624.49260_at_z14g2000cwz.googlegroups.com>
Date: 25 Nov 2004 10:04:32 -0800
Message-ID: <1101405872.089624.49260_at_z14g2000cwz.googlegroups.com>
Kenneth Downs wrote:
<snip>
> I was just wondering if anybody else considers it possible, as I
> said in my original post.
If my DBMS provided proper support of user defined types
I could declare an interval type e.g. DATEINTERVAL
that would consists of components date_start, date_end,
with operators like OVERLAPS (yields boolean, two parameters of
DATEINTERVAL
CREATE TABLE reservations (
type), then
hotel_room char(4),
span DATEINTERVAL )
candidate key would be (hotel_room, span)
and additional constraint would be declared as
select 0 from reservations r1 NATURAL JOIN reservations r2
where OVERLAPS( r2.SPAN , r1.SPAN) = {}
-- StriderReceived on Thu Nov 25 2004 - 19:04:32 CET