Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
Grouping by a CASE. You can GROUP BY a CASE expression, or by its alias, to count rows per bucket. Each row lands in the bucket of the first WHEN that matches, and the bucket labels become the groups.
select case when list_price < 20 then 'Under 20' else '20 and up' end as band, count(*) as products from products group by band
Customer success wants to know how many accounts are long-standing, how many joined in 2024 and how many are new in 2025.
Return cohort and customers (a count), one row per cohort: 'Before 2024' for signup_date before 2024-01-01, '2024' for signups during 2024, and '2025' for signups from 2025-01-01 on.
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe