IS NULL Operator - SQL


Overview


The IS NULL Operator in SQL is used to filter the result set to include only the rows where the specified column contains a NULL value. It checks for the presence of NULL values in a column.

Syntax:

SELECT column
FROM table_name
WHERE column1 IS NULL

column1 IS NULL checks if the value in column1 is NULL.

Sample Data:

department_id first_name
3 Frank
2 Jane
3 Ashley
NULL Glenn
2 Kelly
1 Richard
1 George
5 Kyle
2 James
1 Gustavo

Example


In this example, we are returning the department_id and the first_name column. We then use the IS NULL operator to filter the results to only include rows where the department_id column is null.

Example:

SELECT department_id, first_name
FROM company.employees
WHERE department_id IS NULL