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

Instruction

Okay, it's time to do a few more exercises.

Exercise

For each single rental, show its Id, RentalDate, Platform, PaymentDate, PaymentAmount, and the average payment amount. Calculate this amount by taking into account the previous two rows, the current row, and the next two rows when sorted by the PaymentDate. Name the column AvgPaymentAmount.

Stuck? Here's a hint!

Here, the window frame will be:

ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING