[nycphp-talk] Need help understanding NULL
Kristina D. H. Anderson
ka at kacomputerconsulting.com
Sat Aug 29 22:31:44 EDT 2009
The fun part is when you inherit a database that's such a mess that
your "empty" fields are either NULLs, or ''s, OR even ' 's.
And of course all the boolean fields use 0 for true and 1 for
false...just to really make your day. Real-world programming
> John Campbell wrote:
> > In sql, every comparison to NULL, yields another NULL.
> > That is why 'SELECT * WHERE foo = NULL' doesn't do what you might
> > expect. In fact that query is guaranteed to always return zero
> which is why the correct syntax for such a select would have to be
> 'SELECT * [FROM table] WHERE foo IS NULL' rather than '= NULL'
> Michael Southwell
> Vice President, Education
> NYPHP TRAINING: http://nyphp.com/Training/Indepth
> New York PHP User Group Community Talk Mailing List
More information about the talk