PrepZone Logo
PrepZone
Back to Database

Database · Medium

Compute a 3-order moving average of order amounts per customer.

DatabaseSQL QueriesSeniorWindow Functions

Answer preview

Average over a sliding frame of the current row and the two before it with ROWS BETWEEN 2 PRECEDING AND CURRENT ROW.…