SQL NULL Comparison: Why = NULL Never Works
By Sharon Ben-Moshe · June 14, 2026 · 4 min read
Sharon Ben-Moshe is the founder of sqlfmt, a browser-based SQL formatter and validator with misspelled-keyword suggestions across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery.
SQL's = NULL comparison always returns unknown, never true. Learn why NULL requires IS NULL, how three-valued logic works, and how to fix common NULL bugs.
Quick answer
In SQL, NULL represents an unknown value. Comparing NULL with = always returns UNKNOWN — not TRUE or FALSE — so WHERE column = NULL filters out every row. Use IS NULL or IS NOT NULL to test for missing values.