SQL NULLIF
13 October 2025 (Updated 17 October 2025)
On this page
What is NULLIF()?
The NULLIF() function returns NULL if the two given expressions are the same, otherwise it returns the first expression.
Syntax
NULLIF(expr1, expr2)
Examples
SELECT NULLIF(1, 1)
-> NULL
SELECT NULLIF(1, 2)
-> 1
Tagged:
SQL