Write a SQL query that returns the top 10 customers by total spent.
Given a table of customer data, write a SQL query that returns the top 10 customers by total spent. Example input: | customer_id | name | total_spent | |--------------|------|-------------| | 1 | John | 100 | | 2 | Jane | 200 | | 3 | Joe | 300 | | 4 | Bill | 400 | | 5 | Lisa | 500 | Example output: | customer_id | name | total_spent | |--------------|------|-------------| | 5 | Lisa | 500 | | 4 | Bill | 400 | | 3 | Joe | 300 | | 2 | Jane | 200 | | 1 | John | 100 |
select customer_id, name, total_spent from customer_data order by total_spent desc limit 10
This solution is correct and demonstrates a level of completeness. The approach is straightforward and easy to follow.
Evaluated at: 2023-01-21 05:24:42