Conditional Operators
- reference
Simple Case Expressions

Simple case expressions allow for conditional matching within an expression. The evaluation process is as follows:
-
The first WHEN expression is evaluated. If it is equal to the search expression, the result of this expression is the THEN expression.
-
If it is not equal, subsequent WHEN clauses are evaluated in the same manner.
-
If none of the WHEN expressions are equal to the search expression, then the result of the CASE expression is the ELSE expression.
-
If no ELSE expression was provided, the result is NULL.
Searched Case Expressions

Searched case expressions allow for conditional logic within an expression. The evaluation process is as follows:
-
The first WHEN condition is evaluated.
-
If TRUE, the result of this expression is the THEN expression.
-
If not TRUE, subsequent WHEN clauses are evaluated in the same manner.
-
If none of the WHEN clauses evaluate to TRUE, then the result of the expression is the ELSE expression.
-
If no ELSE expression was provided, the result is NULL.