PostgreSQL – IS NULL

IS NULL condition is used in the WHERE clause to identify records that do not have a value.

Syntax:

SELECT * FROM table_name WHERE column_name IS NULL;

Consider an employee table as shown below:

idfirst_namelast_namedepartmentsalaryemail
101bryanwalkersales50,000bryan.walker@email.com
102alexcarpenteraccounts55,000alex.carpenter@email.com
103samwhitesales60,000sam.white@egmail.com
104johnbarrysales54,000john.barry@email.com
105billwoodaccounts65,000
106roberthopkinssupport70,000
107davidleesupport72,000david.lee@email.com
108jacksearssupport65,000
109tomyoungsales55,000tom.young@email.com

Below is the SQL query to return employees that did not provide an email address:

SELECT * FROM employee WHERE email IS NULL;

id first_name last_name department salary  email
--- --------- --------- ---------- ------  -------
105 bill       wood      accounts   65000
106 robert     hopkins   support    70000
108 jack       sears     support    65000
See also  PostgreSQL - Move table from one schema to another