Top Spender per Country, Keeping Ties

medium
Unit 14 · Window Functions VII0/3 to milestone

For each country, return the customer(s) with the highest total spend: country, name and spend. If two customers tie for first, return both. Sort by country, then name.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#window-functions#rank#top-n2 visible + 1 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Top Spender per Country, Keeping Ties · TechGradify