Skip to main content
Version: 24.3.x

Categories: Conditional

NULLIF

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.

Syntax

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.

Examples

NULLIF example
SELECT NULLIF(user_id, customer_id)
-- user_id