Skip to content

SQL IS Operator

Syntax

The IS operator in SQL is specifically used to compare a column’s value with NULL. Regular comparison operators (e.g., =) do not work with NULL.

-- Check if a column is NULL
SELECT column1, column2
FROM table_name
WHERE column1 IS NULL;
-- Check if a column is NOT NULL
SELECT column1, column2
FROM table_name
WHERE column1 IS NOT NULL;

Example

-- Retrieve rows where age IS NULL
SELECT name, age
FROM employees
WHERE age IS NULL;
/* Output:
| name | age |
|-------------|------|
| Alice Brown | NULL |
*/
-- Retrieve rows where age IS NOT NULL
SELECT name, age
FROM employees
WHERE age IS NOT NULL;
/* Output:
| name | age |
|------------|-----|
| John Doe | 30 |
| Jane Smith | 25 |
*/