trying to revive an old thread for fun...
> I inherited a system in which the code was writing the string "NULL"
> CHAR field.
This is what happens when one of the most innovative concepts of SQL
or understressed which it seems to be in most modern SQL books.
The thing is that SQL's logic isn't binary. Rather it's built over
three values: TRUE, FALSE, NULL.
You can indeed compare anything to NULL:
x = NULL
in most systems is a valid syntax. The result is NULL if x is not NULL,
and the result of
NULL = NULL
I honestly don't remember, but it's either NULL or FALSE, definitely
The same goes for any other binary operator I can imagine.
x IS NULL
on the other hand isn't a binary operator, it's an UNARY one with the
result values of TRUE or FALSE.
The whole join theory obviously revolves around NULL treatment but
otherwise the NULL algebra becomes
fuzzy. I'm not sure what the standards say to the question of sorting
NULLs, or whether each null constitutes
a separate group as in GROUP BY, or all can be grouped together, but
the actual implementations
often make the answers configurable.
I wish SQL educators paid a little more attention to the math of it. On
the other hand describing joins
in a kind of 'traditional' mathematics [no pictures, just symbols] is
definitely an overkill.
It took me a long time to figure out what MySQL CLI was
> These kids today...
Oh my, sounds like a candidate for www.thedailywtf.com :-)
Database Workbench - development tool for MySQL, and more!
Database development questions? Check the forum!
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=1
Check Out the new free AIM(R) Mail -- 2 GB of storage and
industry-leading spam and email virus protection.