When working with sales data, looking at daily sales figures individually does not always give you a clear picture of business performance.
For example, sales might increase on Monday, drop on Tuesday, and rise again on Wednesday. These daily changes can make it difficult to understand the overall trend.
This is where a Moving Average in SQL becomes useful.
A moving average helps smooth out daily fluctuations by calculating the average over a specific number of previous rows.
In this SQL challenge, let's see how to calculate a 7-row moving average using the AVG() window function in Oracle SQL.
The Business Scenario
Imagine you are working on a sales reporting project.…