CASE
mysql> SELECT CASE 1 WHEN 1 THEN 'one' -> WHEN 2 THEN 'two' ELSE 'more' END; -> 'one' mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END; -> 'true' mysql> SELECT CASE BINARY 'B' -> WHEN 'a' THEN 1 WHEN 'b' THEN 2 END; -> NULL
IFNULL
mysql> SELECT IFNULL("TEST", 'OK'); +----------------------+ | IFNULL("TEST", 'OK') | +----------------------+ | TEST | +----------------------+ 1 row in set (0.00 sec) mysql> SELECT IFNULL(NULL, 'OK'); +--------------------+ | IFNULL(NULL, 'OK') | +--------------------+ | OK | +--------------------+ 1 row in set (0.00 sec)
NULLIF()
IF
mysql> SELECT IFNULL("TEST", 'OK'); +----------------------+ | IFNULL("TEST", 'OK') | +----------------------+ | TEST | +----------------------+ 1 row in set (0.00 sec) mysql> SELECT IFNULL(NULL, 'OK'); +--------------------+ | IFNULL(NULL, 'OK') | +--------------------+ | OK | +--------------------+ 1 row in set (0.00 sec)