Introduction
Quick Refresher
PARTITION BY ORDER BY with Ranking
PARTITION BY ORDER BY with Window Frames
14. Practice Time!
Using PARTITION BY ORDER BY with Analytical Functions
Summary and Review

Instruction

Super! By the same token, you can use PARTITION BY ORDER BY with any other window frame. Shall we practice a bit more?

Exercise

Take sales from August 1 to August 10, 2016. For each row, show the following information: StoreId, Day, number of transactions, and the average number of transactions for that store in the window frame starting 2 days before and ending 2 days after the current row. Name the column AvgTransactions.

Stuck? Here's a hint!

Use:

ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING