Introduction
Simple OVER()
PARTITION BY
Ranking functions
Window Frames
Analytic Functions
24. Analytic Functions – Exercise 2
PARTITION BY ORDER BY
Order of Evaluation
Finished!

Instruction

Piece of cake for you! Maybe the next one will be of some challenge?

Exercise

For each single rental, show the following columns: Id, PaymentDate, PaymentAmount, the PaymentAmount of the previous SingleRental in terms of the PaymentDate (column PreviousPayment) and the difference between the last two values (column Difference).

Stuck? Here's a hint!

Use LAG(PaymentAmount) and order by the PaymentDate.