IS NULL

What is IS NULL?

In SQL, IS NULL is used to check whether a column has a NULL value. A NULL represents missing or unknown data, not zero or an empty string.

2. Syntax

SELECT column1, column2
FROM table_name
WHERE column_name IS NULL;
  • column_name – The column you want to check for NULL values.
  • table_name – The table containing the column.

3. Example

Suppose you have a table called Employees:

EmployeeIDNameDepartment
1AliceHR
2BobNULL
3CharlieIT
4DavidNULL

To find all employees without a department:

SELECT Name
FROM Employees
WHERE Department IS NULL;

Result:

Name
Bob
David

4. Using IS NOT NULL

To find rows where a column does have a value, use IS NOT NULL:

SELECT Name
FROM Employees
WHERE Department IS NOT NULL;

Result:

Name
Alice
Charlie

5. Key Points

  • IS NULL is used for filtering missing data.
  • NULL is not the same as zero or empty string.
  • Always use IS NULL or IS NOT NULLdo not use = or != with NULL.
Home » SQL Foundations Program (SQL-101) > Filtering & Conditions > IS NULL