Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
Keep the latest row per key. To keep one row per key, number each group's rows newest first (ORDER BY date DESC) and keep number 1. Apply your filters before numbering: if you number every row first and filter afterwards, a group whose newest row fails the filter loses its row 1 and drops out.
select region_id, month, revenue_target from targets qualify row_number() over (partition by region_id order by month desc) = 1
Daniel Ortiz is cleaning up the West account list and wants one row per customer showing their most recent completed order.
Return customer_name, order_id, order_date and channel of each West customer's (region_id 4) most recent completed order. If a customer has two completed orders on that day, take the higher order_id.
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe