Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
Joining on two keys. Some tables are keyed by more than one column. targets has one row per month and region, so a join needs both: the region and the month. Join on only one and each row matches many targets, which multiplies your totals. Combine the keys with AND inside ON.
select p.product_name, count(*) as lines_at_list_price from order_items oi join products p on p.product_id = oi.product_id and oi.unit_price = p.list_price group by p.product_name
Elena Petrova, who runs North, wants her monthly revenue next to the monthly target for the whole of 2025.
For the North region, return month (1 to 12), revenue (completed orders, quantity × unit_price × (1 − discount_pct), 2 decimals) and revenue_target, 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