Loading...
Select Version
A CASE expression is a conditional expression, i.e. an expression containing conditions. An expression or NULL is assigned to each condition. When the CASE expression is evaluated, the assigned expression value or NULL value is returned to whichever condition is true.
There are different types of CASE expression:
CASE expression with search condition
Simple CASE expression
CASE expression with NULLIF
CASE expression with COALESCE
CASE expression with MIN or MAX
A CASE expression with MIN / MAX references different expressions. In this way it differs from the aggregate functions MIN() and MAX() (see "Aggregate functions") which reference the set of all values in a column in a table.
CASE expressions allow you, for instance, to recode column values or replace specific column values by NULL.