PostgreSQL – IS NULL operator
The PostgreSQL IS NULL operator is used to check if a value is NULL or not. In the world of database Null either means data is missing or not applicable. Hence, it cannot be compared with any integer or string as this kind of comparison always leads to a Null meaning an unknown result.
Syntax: Value IS NULL;
Now, let’s look into a few examples.
Here we will make a query to find all the “first_name” and “last_name” of customers that don’t have an “email” in the “customer” table of our sample database.
SELECT first_name, last_name FROM customer WHERE email IS NULL;
Here we will make a query to find all the “title” of the films that don’t have a “release_year” in the “film” table of our sample database.
SELECT title FROM film WHERE release_year IS NULL;