Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
SUM(CASE …). Put a CASE inside SUM to count or add only some rows: SUM(CASE WHEN rule THEN 1 ELSE 0 END) counts the rows where the rule is true. Several of these side by side turn the values of one column into separate columns.
select region_id, sum(case when segment = 'SMB' then 1 else 0 end) as smb, sum(case when segment <> 'SMB' then 1 else 0 end) as other from customers group by region_id
The weekly ops review shows one line per channel, with completed, refunded and cancelled orders in separate columns.
Return channel, completed, refunded and cancelled: the number of orders with each status in that channel, one row per channel.
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe