List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:December 29 2009 9:27am
Subject:Re: Is anything ever equal to NULL?
View as plain text  
Martijn,


thanks for your excellent mail:

Martijn Tonies wrote:
> [[...]]
> 
> A column can have two states: null or not null. It either has
> data (a value, depending on the datatype), or no data (null),
> which is where <column> IS NULL (has no data) or
> <column> IS NOT NULL (has data) comes into play.

To make it more explicit:
The term "null value" is no proper expression in relational theory.
Values can be compared to each other, and they are equal or not, some of
them even are ordered.
"Null" is no value but a state, signalling "value is unknown".
And of two unknowns you can't even tell whether they are equal or not,
so the result of comparing anything (be it a value or "unknown") to
"unknown" is again "unknown".

That's why logic in SQL is three-valued: true, false, and unknown.


Regards,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  Joerg.Bruehe@stripped
Sun Microsystems GmbH,   Komturstraße 18a,   D-12099 Berlin
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

Thread
Is anything ever equal to NULL?D. Dante Lorenso28 Dec
  • Re: Is anything ever equal to NULL?Michael Dykman28 Dec
  • Re: Is anything ever equal to NULL?David Giragosian28 Dec
    • Re: Is anything ever equal to NULL?Carsten Pedersen28 Dec
      • Re: Is anything ever equal to NULL?David Giragosian29 Dec
  • Re: Is anything ever equal to NULL?Martijn Tonies28 Dec
    • Re: Is anything ever equal to NULL?D. Dante Lorenso29 Dec
    • Re: Is anything ever equal to NULL?Joerg Bruehe29 Dec
  • Re: Is anything ever equal to NULL?Martijn Tonies29 Dec