What is the best way to query for all NULL or non-NULL values in the Panther data lake?
QUESTION
How can I find all occurrences of a NULL value (or conversely, all non-NULL occurrences) in a Panther scheduled query or an ad-hoc Data Explorer search?
ANSWER
To perform a comparison to NULL in your query, use the IS
operator:
SELECT * FROM table WHERE column IS NULL -- or -- SELECT * FROM table WHERE column IS NOT NULL
Note that using the usual equality operators =
and !=
will return no results. This is because any equality operators involving a NULL
value will return NULL
themselves, and thus be excluded from the result set.
For more information on how to handle NULL
values, consult Snowflake's documentation here.