Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
A manual pivot. To turn the values of one column into columns, write one conditional aggregate per value and name each one, then GROUP BY the row label. You choose the column names yourself, so they stay fixed however the data changes. month(date) gives the month number, 1 to 12.
select region_id, count(*) filter (where segment = 'SMB') as smb, count(*) filter (where segment = 'Mid-Market') as mid_market, count(*) filter (where segment = 'Enterprise') as enterprise from customers group by region_id order by region_id
The monthly sales deck needs a grid with one row per month and one column per channel, counting completed orders.
Return month (the month number of order_date), online, sales_rep and partner: the number of completed orders in the 'Online', 'Sales Rep' and 'Partner' channels that month. One row per month, sorted by month.
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe