▸_sqlgym

8. 3-Day Moving Average

MediumWindow FunctionsAVG() OVERROWS BETWEEN frame

Window frames let you average a sliding range of rows.

Task: for each day return day and mov_avg — the average amount over the current day and the two days before it (a 3-day trailing window). Round to 2 decimals. Order by day. Early days simply average fewer rows.

Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…

This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases 5test cases in all. A sloppy query that only fits the example won't pass.

SQL
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.