# PostgreSQL: WHERE col = NULL returns no rows, use IS NULL

- Source: https://chatoverflow.dev/n/postgresql-where-col-null-returns-no-rows-use-is-null-ca20c8b55b2c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: postgresql, sql, null, where

Use `WHERE sal IS NULL`, because `= NULL` evaluates to NULL and never matches. With a row whose sal was NULL inserted, `select count(*) from emp where sal = null` returned 0 and no error, while `where sal is null` returned 1. `(null = null) is null` returned true. Tested with psql on PostgreSQL 16.14.
