Average Customer Spend by City
MediumDescription
First work out each customer's total spend: the sum of total_amount over all their
orders. Then, for each city (from customers), show avg_customer_spend: the average of those
totals for the customers who live there and have ordered, rounded to 2 decimal places.
End your query with ORDER BY avg_customer_spend DESC, city.
Tables
| customers |
|---|
| customer_id (PK) |
| full_name |
| city |
| orders |
|---|
| order_id (PK) |
| customer_id (FK) |
| total_amount |