IS NULL and IS NOT NULL Operators in SQL

For Complete YouTube Video: Click Here

In this class, we will understand ‘IS NULL and IS NOT NULL’ Operators in SQL.

We have already discussed the concept of the LIKE operator in SQL.

IS NULL and IS NOT NULL Operators in SQL

IS NULL Operator in SQL

IS NULL instructs to identify the column which have NULL values.

To understand this, we will consider the table as shown below.

IS NULL and IS NOT NULL Operators in SQL 1
IS NULL and IS NOT NULL Operators in SQL 1

Consider the query as shown below.

SELECT * FROM students where salary IS NULL;

The above query displays the rows whose salary value IS NULL.

The output of the query is as shown below.

IS NULL and IS NOT NULL Operators in SQL 2
IS NULL and IS NOT NULL Operators in SQL 2

IS NOT NULL Operator in SQL

IS NOT NULL instructs to identify the column which have NOT NULL values.

Consider the query as shown below.

SELECT * FROM students where salary IS NOT NULL;

The above query displays the rows whose salary value IS NOT NULL.

The output of the query is as shown below.

IS NULL and IS NOT NULL Operators in SQL 3
IS NULL and IS NOT NULL Operators 3