CASE Statement in SQL — a practical guide to SQL CASE statement with clear examples you can reuse in real projects.
SQL Tutorial Series (44/100). Prefer one article? Read the complete SQL tutorial.
Short description
CASE is the standard way to map values without multiple queries.
Case
SELECT id,
CASE status
WHEN 'paid' THEN 'Completed'
WHEN 'pending' THEN 'Awaiting payment'
ELSE 'Other'
END AS status_label
FROM orders;