Re: Conjunction junction
Date: 1 Nov 2004 07:40:27 -0800
Message-ID: <1099323627.582136.287610_at_c13g2000cwb.googlegroups.com>
Alan wrote:
> The OR _should_ work like an XOR:
>
> SELECT stock_location
> FROM pennants
> WHERE color = 'red' XOR color = 'green' XOR color = 'yellow'
>
> This would return one row, namely, the first one it finds of any of
these
> colors.
No it would not, it would still return all of them, because no row has color='red' AND (color='green' or color='yellow') or any of the other combinations. To demonstrate XOR you need at least 2 attributes:
SELECT stock_location
FROM pennants
WHERE color = 'red' XOR size = 3 XOR shape = 'square';
This would return pennants that are red but NOT size 3 or square, and pennants that are size 3 but NOT red or square, or square but NOT red or size 3.
But you are right that XOR should be part of SQL. Received on Mon Nov 01 2004 - 16:40:27 CET
