SQL Quest › SQL Exercises › SQL CASE WHEN
SQL CASE WHEN Practice — 48 Challenges (38 Free)
48 hands-on challenges counted from the live bank — 8 Easy, 30 Medium, 10 Hard — every one on the skill radar's Conditional Logic axis: a CASE that labels each row, a CASE that buckets rows for GROUP BY, and a CASE inside SUM or COUNT for conditional counts, rates and pivots. 38 are free to play; the Hard ones are Pro. Real datasets, AI tutoring.
Start Practicing Free →
Two Easy warm-ups on calculated columns (ROUND and arithmetic, no CASE) share the radar skill and count toward the total; they appear in no section below. CASE is an expression — it goes anywhere a value goes — so the three sections are the three places you will meet it.
CASE in SELECT — label every row: 12 challenges (9 free)
A searched CASE — CASE WHEN salary >= 100000 THEN 'Senior' WHEN salary >= 60000 THEN 'Mid' ELSE 'Junior' END AS tier — adds a computed column and groups nothing. Start with Comp Tier Labels and Membership Display Labels, written for the syntax (searched and simple CASE); the Medium ones combine conditions with AND and dates; the Hard ones put the CASE after a window function or a self-join, and Self-Join: Manager Salary Comparison sorts by it — CASE in ORDER BY. For the syntax and the NULL trap, read the CASE WHEN tutorial.
Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.
Easy Free
Comp Tier Labels
Uses: CASE ORDER BY
Try it →
Easy Free
Membership Display Labels
Uses: CASE
Try it →
Easy Free
Asset Tier Classification
Finance & Banking track · Uses: CASE
Try it →
Easy Free
Building Age Tier
Real Estate track · Uses: CASE WHERE
Try it →
Easy Free
Tool Wear Stress Tier
Manufacturing & Industry track · Uses: CASE ORDER BY
Try it →
Medium Free
Management Hierarchy Overview
Uses: LEFT JOIN EXISTS Subquery COALESCE
Try it →
Medium Free
Bonus Tier with Cross-Conditions
Uses: CASE AND Filter
Try it →
Medium Free
Promotion Eligibility Matrix
Uses: CASE Date Functions AND Date Functions + CASE
Try it →
Medium Free
Customer Signup Quarter (Date + CASE)
Uses: Date Functions strftime CASE
Try it →
Hard Pro
Order Sessionization by Customer
Uses: CTE Window Functions LAG CASE
Try it →
Hard Pro
Self-Join: Manager Salary Comparison
Uses: Self-Join LEFT JOIN CASE ROUND
Try it →
Hard Pro
Department Salary Percentile Buckets
Uses: Window Functions NTILE PARTITION BY CASE
Try it →
CASE alongside GROUP BY — buckets and labels on grouped rows: 19 challenges (15 free)
CASE builds the bucket — an age band, a tenure band, a rating tier — and GROUP BY counts or averages inside it; grouping by the CASE alias, or repeating the expression, is the whole trick. Start with Spend by Day of Week, the Easy one, then Introduction to CASE WHEN; Movie Rating Tier Breakdown and Age Group Survival Analysis are the classic shape. The Hard ones carry the bucket through CTEs and window functions, and UNION ALL Dedup uses its CASE in ORDER BY to pin a total row last. The GROUP BY tutorial has the mechanics.
Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.
Easy Free
Spend by Day of Week
Uses: CASE GROUP BY strftime Date Functions
Try it →
Medium Free
LEFT JOIN NULL Semantics: Inactive Customers
Uses: LEFT JOIN COALESCE Aggregation GROUP BY
Try it →
Medium Free
Introduction to CASE WHEN
Uses: CASE GROUP BY Aggregation
Try it →
Medium Free
Category Revenue with Relabeling
Uses: CASE GROUP BY Aggregation ORDER BY
Try it →
Medium Free
Subquery in FROM (Derived Table)
Uses: Subquery Derived Table JOIN GROUP BY
Try it →
Medium Free
Movie Rating Tier Breakdown
Uses: CASE GROUP BY Aggregation CASE + GROUP BY
Try it →
Medium Free
UNION ALL Dedup: Cross-Dataset Search
Uses: UNION ALL UNION CTE CASE
Try it →
Medium Free
Title Social Survival Analysis
Uses: GROUP BY Aggregation HAVING CASE
Try it →
Medium Free
Employee Tenure Bands
Uses: Date Functions CASE CTE GROUP BY
Try it →
Medium Free
Quarterly Hiring Cohort Report
Uses: Date Functions CASE GROUP BY Aggregation
Try it →
Medium Free
Age Group Survival Analysis
Uses: CASE GROUP BY Aggregation CASE + GROUP BY
Try it →
Medium Free
Family Size Survival Buckets
Uses: CASE GROUP BY Aggregation Calculated Column
Try it →
Medium Free
Trust and Savings Banks
Finance & Banking track · Uses: WHERE LIKE CASE GROUP BY
Try it →
Medium Free
LLC vs Individual Buyers
Real Estate track · Uses: CASE GROUP BY Aggregation String Functions
Try it →
Medium Free
Trust Banks vs Others — NPL Profile Comparison
Finance & Banking track · Uses: JOIN GROUP BY CASE Aggregation
Try it →
Hard Pro
Customer Lifetime Value Pipeline
Uses: JOIN Subquery Window Functions NTILE
Try it →
Hard Pro
Island Length Classification
Uses: CTE Window Functions ROW_NUMBER GROUP BY
Try it →
Hard Pro
Failure Rate by Torque Bucket
Manufacturing & Industry track · Uses: CTE JOIN CASE GROUP BY
Try it →
Hard Pro
How Concentrated Is the Spend?
Uses: CASE CTE ROW_NUMBER Subquery
Try it →
Conditional aggregation and pivots — SUM(CASE WHEN …): 16 challenges (13 free)
Put the CASE inside the aggregate — SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) — and one GROUP BY row carries several conditional counts at once: that is the pivot, the rate, the funnel. Start with Conditional Counting with CASE, then Pivot: Order Status by Country, the one written for the pivot; Order Funnel Conversion is the Hard one. The cheat sheet has the pattern in one screen: CASE WHEN inside aggregates.
Counted from the challenge bank, September 2026. Medium first, then Hard.
Medium Free
Category Revenue with Relabeling
Uses: CASE GROUP BY Aggregation ORDER BY
Try it →
Medium Free
Genre Financial Report
Uses: GROUP BY HAVING Aggregation CASE
Try it →
Medium Free
Department Compensation Report
Uses: GROUP BY HAVING Aggregation CASE
Try it →
Medium Free
Pivot: Order Status by Country
Uses: GROUP BY CASE Aggregation SUM
Try it →
Medium Free
Genre Box Office Report
Uses: GROUP BY Aggregation NULL Handling ORDER BY
Try it →
Medium Free
Fare Imputation Analysis
Uses: NULL Handling COALESCE GROUP BY Aggregation
Try it →
Medium Free
Email Provider Customer Analysis
Uses: String Functions GROUP BY Aggregation ORDER BY
Try it →
Medium Free
Department Performance Rate
Uses: GROUP BY Aggregation CASE Rate Calculation
Try it →
Medium Free
Performance vs Salary Analysis
Uses: GROUP BY CASE Aggregation ORDER BY
Try it →
Medium Free
Conditional Counting with CASE
Uses: CASE Aggregation GROUP BY BETWEEN
Try it →
Medium Free
Inactive Customers by Tier
Uses: LEFT JOIN CASE GROUP BY Derived Table
Try it →
Medium Free
Geographic Concentration — Single-State Banks
Finance & Banking track · Uses: JOIN GROUP BY Aggregation CASE
Try it →
Medium Free
Ticket-Size Mix by Category
Uses: CASE SUM GROUP BY
Try it →
Hard Pro
Order Funnel Conversion
Uses: CASE Aggregation Conditional Aggregation
Try it →
Hard Pro
Cards That Never Spend at Home
Uses: CASE HAVING GROUP BY COUNT DISTINCT
Try it →
Hard Pro
Disputed Spend by Risk Tier and Category
Uses: CASE CTE LEFT JOIN PARTITION BY
Try it →
CASE also turns up inside window functions, JOIN conditions and CTEs; the challenges that combine it with those live on the sibling pages — window functions, joins, CTEs and subqueries.