CASE
Evaluates a list of conditions and returns the first resulting true expression. If a true expression is not found, will return the ELSE statement, if present, or else will return NULL.
Syntax
CASE expression WHEN condition THEN result [ …n ] [ ELSE result ] END → same as input type
expression: A valid SQL expression, typically, a column name.
condition: A boolean expression. If
condition
is true, then returnresult
.result: A valid SQL expression.
Examples
CASE example
CASE WHEN condition THEN result [ …n ] [ ELSE result ] END → same as input type
condition: A boolean expression. If
expression=condition
is true, then returnresult
.result: A valid SQL expression.
Examples
CASE example
Last updated