Window Functions

Running Totals & Moving Averages: Mistakes

Not specifying frame for moving average AVG(...) OVER (ORDER BY date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) Default frame includes all preceding rows. Specif

Not specifying frame for moving average

AVG(...) OVER (ORDER BY date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW)

Default frame includes all preceding rows. Specify exact window.

Always specify frame for moving averages

High

Wrong window size