beginnerSQL Fundamentals Deep Dive — Data Types, NULL Handling & Query Execution Order

Why does WHERE column = NULL never match any rows, even when the column genuinely contains NULLs?

NULL represents 'unknown,' not a comparable value — NULL = NULL evaluates to NULL (unknown), not TRUE, because SQL uses three-valued logic (TRUE/FALSE/UNKNOWN) and only rows evaluating to exactly TRUE are kept. The correct form is WHERE column IS NULL, which checks for the unknown state directly rather than comparing against it.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

Why does WHERE column = NULL never match any rows, even when the column genuinely contains NULLs?

Next Step

Continue to Why should monetary values always be stored as NUMERIC rather than REAL or FLOAT?← Back to all SQL questions