ISNULL Function - SQL


Overview


The ISNULL function in SQL checks whether an expression is null and returns a specified value if it is. It is commonly used to handle null values by substituting them with a default value.

Example:

SELECT ISNULL(department_id, 10)
FROM company.employees

Syntax:

SELECT ISNULL(expression, replacement_value)
FROM table_name

expression is the value to check for null.

replacement_value is the value returned if expression is null.