SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

3-Day Moving Average of Orders

Unsolved

DoorDash analysts smooth noisy daily order volume with a trailing 3-day moving average. For a given day, the moving average is the mean of `orders_count` for that day and the two preceding days. Write an SQL query that returns `order_day`, `orders_count` and `moving_avg_3d` (rounded to 2 decimal places). Only include days that have a full 3-day window (so the first two days are excluded). Order the results by `order_day` ascending.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 DoorDash🏢 Uber🏢 Instacart

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM daily_orders
Full source dataset
10 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine