Live SQLite 3.54 Sandbox
SQL CASE WHEN (Conditional Logic) (with live sandbox)
CASE WHEN adds IF / IFS logic inside SQL queries — ideal for bucketing tiers and writing conditional SUM(CASE WHEN ...) totals.
Syntax
SELECT order_id, CASE WHEN amount >= 10 THEN 'Large' ELSE 'Standard' END AS size FROM orders;Label each order 'Large' if amount >= 10, else 'Standard', as size.
SQLite 3.50 SandboxCtrl/Cmd + Enter to Run (unlimited & ungraded)
Practise CASE WHEN (Conditional Logic) in our free SQL track
Same streak & XP across Excel, Google Sheets, and SQL.
Free 1-Page Excel, Google Sheets & SQL Interview Cheat Sheet
The 25 formulas, keyboard shortcuts, and SQL patterns tested most in analyst interviews — emailed instantly, zero spam.