This problem asks for a SQL query that returns the names and total amounts spent by customers who have made a purchase in the last 30 days.
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.
Evaluated at: 2022-11-06 01:15:38