Open In App

PostgreSQL – IS NULL operator

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

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;

For the sake of this article we will be using the sample DVD rental database, which is explained here and can be downloaded by clicking on this link in our examples.

Now, let’s look into a few examples.

Example 1:
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;

Output:

Example 2:
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;

Output:


Last Updated : 28 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads