Say you're comparing two Snowflake columns and you want to know how many rows are different. No problem, you think:
where start_date != end_date;
Wait a minute. If some of the start or end dates are null, they won't be counted! 😬 That's definitely not what you wanted. That's why you need to use the INTERSECT operator:
where not exists(select start_date from sessions intersect select end_date from sessions);
Now, your count will be “null aware” and you'll get the result you want.
Spread the word