Skip to main content

NULLIF

Returns NULL if two expressions are equal. Otherwise return expr1. They must have the same data type.

Syntax

NULLIF(<expr1>, <expr2>)

Examples

SELECT NULLIF(0, NULL);

┌─────────────────┐
nullif(0, null)
├─────────────────┤
0
└─────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today