Skip to content
Advertisement

Difference between x = null vs. x IS NULL

In Snowflake, what is the difference between x = NULL and x IS NULL in a condition expression? It seems empirically that x IS NULL is what I want when I want to find rows where some column is blank. I ask because x = NULL is treated as valid syntax and I am curious whether there’s a different application for this expression.

Advertisement

Answer

This particular case is well-described in Snowflake’s documentation:

EQUAL_NULL

IS [ NOT ] DISTINCT FROM

Compares whether two expressions are equal. The function is NULL-safe, meaning it treats NULLs as known values for comparing equality. Note that this is different from the EQUAL comparison operator (=), which treats NULLs as unknown values.

Advertisement