Skip to main content

Command Palette

Search for a command to run...

Null-safe comparison: IS DISTINCT/NOT DISTINCT FROM

Updated
1 min read
Null-safe comparison: IS DISTINCT/NOT DISTINCT FROM
C

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

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.


Enjoyed this? Here are some related articles you might find useful:

More from this blog

D

Datawise: A blog on SQL, BigQuery, Analytics, Python Tips and Tricks

204 posts

Data Engineer with a passion for transforming complex data landscapes into insightful stories. Here on my blog, I share insights, challenges, and the ever-evolving dance of technology and business.