COALESCE function in BigQuery
The COALESCE function in BigQuery is used to return the first non-NULL expression among its arguments. If all expressions evaluate to NULL, the function returns NULL.
SQL Syntax
COALESCE(expression1, expression2, ..., expressionN)
Key Rules
- Expressions are evaluated from left to right.
- The first non-NULL value is returned.
Example:
SQL
SELECT COALESCE(NULL, "", "Ashish") AS return_value;
The result of the above query is shown below:

Evaluation Order
- NULL is ignored because it is NULL.
- "" is an empty string, but it is NOT NULL.
- "Ashish" is never reached.
Important Concept
- "" (empty string) is NOT NULL.
- COALESCE() does not skip empty strings.