# Null-safe comparison: IS DISTINCT/NOT DISTINCT FROM


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](https://www.linkedin.com/posts/sebastian-flak_the-sql-comparison-operator-you-should-activity-7322288997945212928-3hOZ?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAvrnvABKPsQ1CE0m9jhBpQ-Vr-YZbN9dqg).

Works on BigQuery too, so I guess less need of adding IFNULLs / COALESCE for safety.

![](https://miro.medium.com/v2/resize:fit:700/0*Wb4zGkbHhG9oEoVC align="left")

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***](https://notjustsql.com/)*.*

---

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

- [A couple of fun things about NULL in SQL](https://datawise.dev/a-couple-of-fun-things-about-null-in-sql)
- [Not all NULLS are the same](https://datawise.dev/not-all-nulls-are-the-same)
- [COALESCE vs IFNULL vs NULLIF in BigQuery](https://datawise.dev/coalesce-vs-ifnull-vs-nullif-in-bigquery)
- [Controlling ordering of NULL values in the ORDER BY clause](https://datawise.dev/controlling-ordering-of-null-values-in-the-order-by-clause)

