Here is a little tid bit about a useful MySQL extension to the SQL standard, since I have given this same hint to several people in a short timeframe. A good friend from good old Berlin who runs a site for selling car parts was the first to ask, so I am giving him credit for bringing this nifty operator back to mind. Essentially the problem is that frequently we want to easily handle matching against some value or NULL with the same code. Obviously the standard expects you to switch from the standard equal operator to "IS" for matching a NULL. After all NULL is not equal to anything. Right, but its tedious to handle this in the code so MySQL invented the "<=>" operator aka the "NULL-safe equal to operator". Also very useful in combination with prepared statements.
Side note: I must …
[Read more]