» Documentation » SQL Reference

Case

Syntax

CASE
WHEN boolean expression THEN result expression [, ...]
[ELSE result expression]
END

CASE expression
WHEN expression THEN result expression [, ...]
[ELSE result_expression]
END 

boolean expression syntax

expression {= | > | < | >= | <= | != | <>} {expression } 

expression BETWEEN lower_expression AND upper_expression 

expression IS [NOT] NULL 

expression [NOT] LIKE 'sql_like_string' 

boolean expression {AND | OR} boolean expression 

results expression can be a column, function or constant. 

Evaluates a list of conditions and returns one of multiple possible result expressions. CASE statement can be used in