Hi Carl!

> Paul DuBois writes:
>
> > NULL basically means "unknown value", so saying WHERE x = NULL cannot
> > work, even if x is NULL.  That means "where one unknown value = another
> > unknown value", which cannot be evaluated with any certainty. :-)
>
> It is sort of odd, though, that x = NULL returns something which
> appears to be undefined rather than something well-defined
> (such as false all the time) or an error (which could be said to
> be well-defined, if errors are considered to be valid responses
> to queries...).

Well which would you prefer, false or error? Dealing with errors is
annoying if not necessary. 'False' is incorrect -if- the field is allowed
to contain 'nothing' because NULL means it does contain nothing.

Both 0 and "" are 'not nothing.' They are distinct values within their set
of allowed values. NULL is a 'different' kind of value that is very very
useful in many cases.

For a field that is allowed to contain NULL: A query that returns NULL
means essentially 'do nothing with these results.' A query that returns 0
or "", without -further- tests for those values, means 'do something with
these values.' When coding it's easier to 'do nothing' rather than test
further and later decide you really need to 'not do something.' :)

As I just posted to another message, read through the hits returned by
http://www.mysql.com/doc/manual.php?search_query=null . As described there
dealing with NULL requires a 'different' kind of thinking. It's like
thinking about black holes or Heisenberg's box or /dev/null or other
places that don't really 'exist' in our normal human plane of reference
*but* do in fact exist and can be used.

Have a :) day!

jb

ob-filter-words: database table sql

-- 
jim barchuk
[EMAIL PROTECTED]



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to