by AskAI

Solutions:

Check these solutions from our community and artificial intelligence:
The solution above is optimal because it uses the GROUP BY clause to group the results by customer_id and name, and the SUM() function to calculate the total amount spent by each customer.