NYCPHP Meetup

NYPHP.org

[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 
scenarios!!


Kristina

> 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 
rows.
> 
> 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
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> http://www.nyphp.org/show_participation.php
> 
> 








More information about the talk mailing list