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 NULLSELECT column1, column2FROM table_nameWHERE column1 IS NULL;
-- Check if a column is NOT NULLSELECT column1, column2FROM table_nameWHERE column1 IS NOT NULL;Example
-- Retrieve rows where age IS NULLSELECT name, ageFROM employeesWHERE age IS NULL;/* Output:| name | age ||-------------|------|| Alice Brown | NULL |*/
-- Retrieve rows where age IS NOT NULLSELECT name, ageFROM employeesWHERE age IS NOT NULL;/* Output:| name | age ||------------|-----|| John Doe | 30 || Jane Smith | 25 |*/