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

Example:

SQL

SELECT COALESCE(NULL, "", "Ashish") AS return_value;    

The result of the above query is shown below:

COALESCE function in BigQuery

Evaluation Order

Important Concept