AnalystPath

Top 3 Cities by Total Order Amount

SQLMediumMid levelAmazon~15 min

Problem

**[Asked at Amazon]**

Find the **top 3 cities by total order amount**.

Return `city` and `total_amount`, ordered by total amount descending.

Tables

Example rows — the live problem includes the full dataset.

customers
customer_idnamecity
orders
order_idcustomer_idorder_amountorder_date

Expected output

Your answer should return 3 rows with the columns city, total_amount.

Starter code (SQL)

SELECT *
FROM customers;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions