Introduction
Simple OVER()
PARTITION BY
Ranking functions
Window frame
20. Window frame – Exercise 2
Analytic functions
ORDER BY PARTITION BY
Order of evaluation
Summary

Instruction

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

Exercise

For each single rental, show its id, rental_date, platform, payment_date, payment_amount and the average payment amount calculated by taking into account the previous two rows, the current row and the next two rows when sorted by the payment_date.

Stuck? Here's a hint!

Here, the window frame will be: ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING.

Console

Code editor

Result

TableConsole