CASE

Executes the THEN sql_statement_list where the boolean expression is true, or the optional ELSE sql_statement_list if no conditions match.

Grammar Syntax

CASE
  WHEN boolean_expression THEN sql_statement_list
  [...]
  [ELSE sql_statement_list]
END CASE;

--CASE search_expression
CASE search_expression
  WHEN expression THEN sql_statement_list
  [...]
  [ELSE sql_statement_list]
END CASE;

Click here to go to the BigQuery specification for this syntax.

Sample Source Patterns

Simple CASE

CASE search_expression

Last updated

Was this helpful?