3-Day Moving Average
Medium
Window Functions
For every day return the average sales over that day and up to two preceding days (fewer days at the start), rounded to two decimals.
Table schema
DailySales(sale_date DATE PRIMARY KEY, amount INT)Sample data
sale_date | amount
2026-01-01 | 100
2026-01-02 | 200
2026-01-03 | 300
2026-01-04 | 400
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.