Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1002 Bytes

File metadata and controls

30 lines (20 loc) · 1002 Bytes
description
Evaluates the arguments in order and returns the value of the first expression that does not contain NULL.

COALESCE

Syntax

COALESCE(expression1, expression2, [ …, expressionN ]) → same as input type

  • expression: A combination of symbols and operators that the database evaluates to obtain a single data value. Expressions can be a single constant, variable, column, or scalar function.

Examples

{% code title="COALESCE example" %}

SELECT COALESCE(address1, address2, city, state, zipCode)
FROM customers

-- 123 Main Street

{% endcode %}

Usage Notes

All arguments in the SELECT statement must have the same data type. Requires a minimum of two arguments, but there is no set maximum limit.

\