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
| Function | What it does |
|---|---|
| CASE | CASE returns the result of the first WHEN branch that matches. |
| COALESCE | COALESCE(expr1, expr2, ...) returns the first argument that is not NULL, or NULL if every argument is NULL. |
| IF | IF(condition, true_result, else_result) returns true_result when the condition is TRUE and else_result when it is FALSE or NULL. |
| IFNULL | IFNULL(expr, null_result) returns expr, or null_result when expr is NULL. |
| NULLIF | NULLIF(expr, expr_to_match) returns NULL when the two values are equal and expr otherwise. |
More of the BigQuery reference
Date functionsDatetime functionsTimestamp functionsString functionsAggregate functionsWindow functionsArray functionsJSON functionsConversion functionsMathematical functionsHash and utility functionsQuery syntaxDDL statementsDML statementsScripting and data movementINFORMATION_SCHEMAError messagesBigQuery pricingPricing calculator
