Null-safe comparison: IS DISTINCT/NOT DISTINCT FROM

1 min read

I've been working for surprisingly long with SQL to have found this only a few days ago. Not long enough I guess 🤓.
I'm talking about the NULL-safe operators IS DISTINCT FROM and IS NOT DISTINCT FROM. I found about their existence from a Linkedin post.
Works on BigQuery too, so I guess less need of adding IFNULLs / COALESCE for safety.
PS This choice of keyword "FROM", together with the one in EXTRACT(HOUR FROM DATETIME '2021-01-01'), feels pretty weird.
Found it useful? Subscribe to my Analytics newsletter at notjustsql.com.
0
Subscribe to my newsletter
Read articles from Constantin Lungu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Constantin Lungu
Constantin Lungu
Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified