Re: 3 value logic. Why is SQL so special?

From: Jonathan Leffler <jleffler_at_earthlink.net>
Date: Tue, 19 Sep 2006 07:03:07 GMT
Message-ID: <LCMPg.3409$UG4.2128_at_newsread2.news.pas.earthlink.net>


-CELKO- wrote:

>>> , what would be the consequences of NULL=NULL being true?

>
> NULL=NULL should not be true.
> NULL=NULL should not be false.
> NULL=NULL should not be UNKNOWN.
> NULL=NULL should be NULL. <<
>
> NULL is a missing *attribute* value; UNKNOWN is a *logical* value. The
> first rule of NULLs is that they propagate. You can easily set up
> contradictions that depend on the order evaluation when you have a
> BOOLEAN data type. All SQLK data types must allow NULLs by definition.
>
>
> NULL OR TRUE = NULL -- by definition

By which definition? I thought that was TRUE by definition?

OR T ? F
  T T T T
  ? T ? ?
  F T ? F

(Recommended to use constant-width font for viewing the table.)

> UNKNOWN OR TRUE = TRUE -- by definition
>
> NULL AND TRUE = NULL -- by definition
> UNKNOWN AND TRUE = UNKNOWN -- by definition
>
> This is why we have the <exp> IS [NOT] [TRUE | FALSE |UNKNOWN]
> predicate in SQL-92

-- 
Jonathan Leffler                   #include <disclaimer.h>
Email: jleffler_at_earthlink.net, jleffler_at_us.ibm.com
Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/
Received on Tue Sep 19 2006 - 09:03:07 CEST

Original text of this message