Concept Flow - CASE expression in PostgreSQL
Start Query
Evaluate CASE
Check WHEN condition 1
|Yes
Return THEN result 1
No
Check WHEN condition 2
|Yes
Return THEN result 2
No
Check more WHEN conditions or ELSE
Return ELSE result or NULL
End Query with result
The CASE expression checks each WHEN condition in order and returns the THEN result of the first true condition. If none match, it returns ELSE or NULL.