List:General Discussion« Previous MessageNext Message »
From:doug Date:September 19 2005 3:50am
Subject:Re: Yet another null question
View as plain text  
Thanks but I still do not get why this does not merit a, "you might want to
think about this".

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.

Correct behavior, in that it is a feature, I expected that; desired - no
comment. Probably not expected in that selecting for closed=1 and closed<>1 does
not yield symmetric results. It was the [not] expected nature that lead me to
suggest perhaps an example might be helpful.

From <URL: >

  Note that in MySQL, 0 or NULL means false and anything else means true. The
  default truth value from a boolean operation is 1.

mysql> select * from new_payments where not closed;
Empty set (0.01 sec)

So null is not exactly false, just sorta false. I still think this is worth a
comment in A.5.3.

On Mon, 19 Sep 2005, Roger Baklund wrote:

> doug@stripped wrote:
> > I did not expect that null was not not-equal to 1.
> Any comparison with NULL returns NULL:
> mysql> select null<>1,null>1,null<1,null=1;
> +---------+--------+--------+--------+
> | null<>1 | null>1 | null<1 | null=1 |
> +---------+--------+--------+--------+
> |    NULL |   NULL |   NULL |   NULL |
> +---------+--------+--------+--------+
> 1 row in set (0.00 sec)
> This is the correct and desired behaviour.
> <URL: >
> <URL: >
> <URL: >
> --
> Roger

Douglas Denault
Voice: 301-469-8766
  Fax: 301-469-0601
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