SQL · Reading data
case expression
Returns different values based on conditions. It is an expression, so it can appear in SELECT, WHERE and ORDER BY.
Syntax
case when … then … else … endExample
Open in the lab
More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.