Categories: Conditional


Compares two expressions. If the values in each expression are equal, returns NULL and, if they are not equal, returns the value of the first expression.


NULLIF(expression1, expression2) → same as input type

  • expression: The expressions can be any data type, however all the expressions contained in the argument must be of the same type.


SELECT NULLIF(user_id, customer_id)

-- user_id