Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
ROW_NUMBER(). ROW_NUMBER() OVER (PARTITION BY g ORDER BY x) numbers the rows of each group 1, 2, 3 in x order and never repeats a number, even on ties. Add a second ORDER BY column so ties are settled the same way every run. Number the rows inside a WITH block, then keep row 1 outside it.
with ranked as (
select product_name, category, list_price,
row_number() over (partition by category order by list_price, product_name) as rn
from products
)
select product_name, category, list_price
from ranked
where rn = 1Priya Raman is checking onboarding in the East and wants the first completed order of 2025 for each of her customers.
Return customer_name, order_id and order_date of each East customer's (region_id 3) first completed order. If a customer has two orders on that day, take the lower 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