The VIP program manager wants the top 5 customers ranked by total spending. Return customer_id and the sum of total_amount across all their orders. Only include customers with at least 2 orders. Sort by total spend descending and limit to 5.
Schema
🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql
Run your query to see results
Press Ctrl + Enter to execute