Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Top Customer by Total Spend

Using a derived table of customer totals, return the customer with the highest total spend.

Table schema

Orders(id INT PRIMARY KEY, customer VARCHAR(10), amount INT)

Sample data

id | customer | amount
1 | Ann | 100
2 | Bob | 250
3 | Ann | 200
4 | Cy | 120

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.