Re: Conjunction junction

From: Dan <guntermann_at_verizon.com>
Date: Mon, 01 Nov 2004 19:41:20 GMT
Message-ID: <Ajwhd.4682$pY6.3978_at_trnddc04>


"Laconic2" <laconic2_at_comcast.net> wrote in message news:JoWdnSRsGMlg8xvcRVn-3w_at_comcast.com...
>
> "Alan" <alan_at_erols.com> wrote in message
> news:2un1tqF2bo5daU1_at_uni-berlin.de...
>
>> The worst part is, we don't even have an XOR in SQL.
>
> Most of the time, you can get away with "not equal to" instead of XOR.
> This is usually written "<>", but can be written as "=!" in some dialects,
> IIRC.
>
> So
>
> select * from blocks
> where
> (color = 'RED') <> (shape = 'SQUARE')
>
>
> It's ugly, but it's better than nothing.
>
Very clever, but of course the use of nulls obfuscates the simplicity of this solution. A Null in place of values in either of the attributes or in both will result in the row being returned. The database designer will have to use caution, especially given the tendency for cases where one seeks to enforce rules where one attribute to have a value and the other doesn't. He or she will definitely have to account for 3VL logic unless both attributes are considered as having a value as a mandatory condition/constraint.

Regards,

  • Dan
Received on Mon Nov 01 2004 - 20:41:20 CET

Original text of this message