Топ-100
 

NULLIF

База данных: MySQL
Текст

Syntax:
NULLIF(expr1,expr2)

Returns NULL if expr1 = expr2 is true, otherwise returns expr1. This is
the same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.

The return value has the same type as the first argument.

URL: https://dev.mysql.com/doc/refman/8.0/en/control-flow-functions.html

Пример

mysql> SELECT NULLIF(1,1);
-> NULL
mysql> SELECT NULLIF(1,2);
-> 1