Re: constraints in algebra instead of calculus

From: Jon Heggland <jon.heggland_at_idi.ntnu.no>
Date: Tue, 19 Jun 2007 10:44:44 +0200
Message-ID: <f5851r$cov$1_at_orkan.itea.ntnu.no>


paul c wrote:
> These are the ways I can think of to express the constraint:
>
> 1. COUNT(R{A}) = COUNT(R)
> 2. ( R <AND> (R RENAME A as a, B as b) ) WHERE A = a & B != b IS EMPTY
> (using a grab-bag syntax, possibly inviting correction umpteen + 3)
> 3. the elaborate one using GROUP that Jon H corrected
> 4. something like R GROUP {ALL BUT} as c <AND> constraint{c} IS TRUE/NOT
> EMPTY (where constraint has one tuple for each legal R value and c is
> an rva)
>
> I'd be interested to hear of others as these all seem to rely on various
> devices such a COUNT, RENAME or attribute introductions ala GROUP that
> don't seem very fundamental, but maybe that's just a narrow view on my
> part.

I prefer the rename-join; it can be used for not only superkeys, but FDs in general. I'd formulate it a bit differently from you and Vadim Tropashko, though ... Something like this, perhaps (for a key constraint where B is the non-key attribute):

IS_EMPTY(R RENAME (B AS B') JOIN R WHERE B != B')
> Unless there is a more to-the-point way, I suppose a "KEY"
> keyword device isn't any more obscure than the above!

Indeed. Perhaps easier to optimise, too.

-- 
Jon
Received on Tue Jun 19 2007 - 10:44:44 CEST

Original text of this message