Moving Average with Window Frame
Hard
window-functions
Amazon
Two Sigma
Uber
Write a query to calculate a 3-day moving average of daily revenue. Use a window frame of 1 row preceding and 1 row following. Return day, revenue, and moving_avg (rounded to 2 decimal places), ordered by day.
Expected Output: Each day with its 3-day centered moving average.
Tables
Hints (3 available)
SQL Editor
Output
Click "Run" to see results...