List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:September 20 2005 1:15pm
Subject:Re: Yet another null question
View as plain text  
Hi!


Just some explicit addition:

doug@stripped wrote:
> [[...]]
> 
> So in the following query:
> 
>  select * from new_payments where closed<>1;
> 
> it is desired that null=1. DeMorgan's law takes a vacation here.

You use two-valued logic here, where statements are either "true" or 
"false". (DeMorgan's law applies to two-valued logic only.)

When NULL values are not excluded, SQL uses a three-valued logic, where 
a stament may also be "unknown". Comparing NULL to any value (including 
a comparison of NULL and NULL) always results in "unknown".

This also the reason that the SQL syntax does not allow
    ... WHERE value = NULL
but requires that you write
    ... WHERE value IS NULL
It has also been said that NULL is no value but a state - maybe that 
helps in understanding.


HTH,
Jörg

-- 
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com
Thread
Yet another null questiondoug19 Sep
  • Re: Yet another null questionRoger Baklund19 Sep
    • Re: Yet another null questiondoug19 Sep
      • Re: Yet another null questionJasper Bryant-Greene19 Sep
      • Re: Yet another null questionJoerg Bruehe20 Sep
        • Re: Yet another null questiondoug20 Sep
    • Re: Yet another null questiondoug19 Sep
  • Re: Yet another null questionMartijn Tonies19 Sep
    • Re: Yet another null questiondoug19 Sep