SQL Data Analyst — Medium
Key points
- The function is partitioned by region, so it calculates the running total separately for each region.
- The ordering by sale_date ensures the running total is based on the chronological order of sales.
- The ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW specifies the range of rows to include in the running total.
Ready to go further?
Related questions
