PrepZone Logo
PrepZone
Back to Database

Database · Medium

Compute a running total of order amounts per customer ordered by date.

DatabaseSQL QueriesSeniorWindow Functions

Answer preview

Use SUM() OVER (PARTITION BY customer_id ORDER BY order_date) with an explicit frame so each row carries the cumulative total for that customer.…