AI engineering glossary · SQL databases
What is CASE expression?
CASE expression: SQL's way of writing if-then-else inside a query. It checks conditions in order and returns the value of the first true branch, or an ELSE value. It can appear in SELECT, WHERE, ORDER BY and inside aggregates.
CASE expression: an example
CASE WHEN amount >= 1000 THEN 'high' ELSE 'low' END labels each order as high or low value.
Related terms
More SQL databases terms
- Check constraint
- Clustered index
- COALESCE
- Column
- COMMIT and ROLLBACK
- Common table expression
- Composite index
- Connection pool
Where you learn it
CASE expression is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.