Request a demo

BigQuery reference

BigQuery conditional expressions

Conditional expressions choose a value based on a condition or on NULLs. They are evaluated lazily, so a branch that is not taken never raises an error.

Functions in this category

FunctionWhat it does
CASECASE returns the result of the first WHEN branch that matches.
COALESCECOALESCE(expr1, expr2, ...) returns the first argument that is not NULL, or NULL if every argument is NULL.
IFIF(condition, true_result, else_result) returns true_result when the condition is TRUE and else_result when it is FALSE or NULL.
IFNULLIFNULL(expr, null_result) returns expr, or null_result when expr is NULL.
NULLIFNULLIF(expr, expr_to_match) returns NULL when the two values are equal and expr otherwise.

More of the BigQuery reference

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.