The MySQL NULLIF() control flow function will return NULL if the two parameters are the same, otherwise it will return the first parameter.
NULLIF(expression1, expression2)
Here, if expression1 = expression2, NULLIF() will return NULL, otherwise it will return expression1. The following example will demonstrate this -
mysql> Select NULLIF('Ram','Ram'); +---------------------+ | NULLIF('Ram','Ram') | +---------------------+ | NULL | +---------------------+ 1 row in set (0.00 sec) mysql> Select NULLIF('Ram','Shyam'); +-----------------------+ | NULLIF('Ram','Shyam') | +-----------------------+ | Ram | +-----------------------+ 1 row in set (0.00 sec)
The above is the detailed content of What is the use of the MySQL NULLIF() control flow function?. For more information, please follow other related articles on the PHP Chinese website!