Re: UNIQUE and NULL in SQL

From: Nis Jorgensen <nis_at_dkik.dk>
Date: Tue, 08 Jan 2002 16:50:26 +0100
Message-ID: <145m3u8e73jk3hp3lgsundd2n24k4gm6pu_at_4ax.com>


On 30 Dec 2001 19:04:56 -0800, brian-l-smith_at_uiowa.edu (Brian Smith) wrote:

>
>In SQL, a table/column constraint is violated when it's condition is
>FALSE. In the case of a UNIQUE constraint, the condition is "[x] NOT
>IN (SELECT [column] FROM [table])". Now, "NULL NOT IN (SELECT [column]
>FROM [table])" will never be TRUE or FALSE; it is UNKNOWN. Therefore,
>the constraint should not be considered violated since it didn't
>evalutate to FALSE.

You can also look at a constraint as something which must always be true, instead of focusing on the violation. Do you like the integrity of you data to be UNKNOWN? :-)

-- 
Nis Jorgensen
Amsterdam

Please include only relevant quotes, and reply below the quoted text. Thanks
Received on Tue Jan 08 2002 - 16:50:26 CET

Original text of this message