Skip to main content
All Problems
medium0% acceptance

Cumulative Spending Per Customer

For each customer's orders, calculate a running total of their spending over time. Return customer_id, order_date, total_amount, and cumulative_spending (the sum of all their orders up to and including the current one). Sort by customer_id, then order_date.

Schema

🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute