Instruction
Good job! Let's continue the adventure. In Part 5, we learned about window frames. Let's take a look at the following example:
SELECT Id, PaymentDate, PaymentAmount, SUM(PaymentAmount) OVER(ORDER BY PaymentDate ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningTotalAmount FROM Subscription;
In the above query, we calculate a running total paid for all subscriptions up to the current row.
Exercise
For each single rental, show the Id, the RentalDate, the PaymentAmount, and the running total of PaymentAmounts for all rentals, from the oldest one (in terms of RentalDate) to the current row. Name this column RunningTotalAmount.
Stuck? Here's a hint!
Use:
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW



