Returns the first non-NULL value from a list of expressions.
Returns the first non-NULL argument from a list, evaluating left to right. Essential for handling NULLs in expressions, displaying defaults, and building robust queries over sparse data. More concise than nested IFNULL or CASE expressions.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | all | Standard COALESCE. Also IFNULL(expr1, expr2) as a 2-arg shorthand. |
| PostgreSQL | ✓ Supported | all | Standard COALESCE. Accepts any number of arguments. |
| SQL Server | ✓ Supported | all | Standard COALESCE. Also ISNULL(check_expr, replacement) as a 2-arg shorthand (differs from COALESCE in type coercion). |
| Oracle | ✓ Supported | all | Standard COALESCE. Also NVL(expr1, expr2) for 2-arg and NVL2(expr1, not_null_val, null_val) for conditional 3-arg. |
| SQLite | ✓ Supported | all | Standard COALESCE. Also IFNULL(x, y) as a 2-arg shorthand. |
COALESCE is SQL-standard. All engines also ship proprietary 2-argument shorthands (IFNULL, ISNULL, NVL) that predate the standard.
Standard COALESCE. Also IFNULL(expr1, expr2) as a 2-arg shorthand.
Standard COALESCE. Accepts any number of arguments.
Standard COALESCE. Also ISNULL(check_expr, replacement) as a 2-arg shorthand (differs from COALESCE in type coercion).
Standard COALESCE. Also NVL(expr1, expr2) for 2-arg and NVL2(expr1, not_null_val, null_val) for conditional 3-arg.
Standard COALESCE. Also IFNULL(x, y) as a 2-arg shorthand.