Introduction
ROWS
10. ROWS – practice 3
RANGE
Default window frame
Summary

Instruction

Amazing! This is the last exercise before we move on.

Exercise

For each SingleOrder, show the PlacedDate, TotalPrice, the average price (calculated by taking two previous orders, the current order, and two following orders in terms of the PlacedDate), and the ratio of the TotalPrice to the average price (calculated as before). The last two columns should be called AvgTotalPrice and Ratio.

Stuck? Here's a hint!

Use ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING.