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;

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:

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.