Each Country's Share of Revenue

medium
Unit 10 · Window Functions III0/2 to milestone

Return country, revenue and pct_of_total: that country's share of all revenue as a percentage, rounded to 1 decimal place. Include only countries with orders, sorted by revenue from highest to lowest.

Try to do it in a single query, without a subquery for the grand total.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#window-functions#aggregation1 visible + 1 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Each Country's Share of Revenue · TechGradify