Skip to content
DatabaseMoving average
SQL

Moving average

Monthly revenue is the sum of quantity × price over that month's orders. For each month give three columns: the month (YYYY-MM), the revenue, and the average of that month's revenue and the two months before it. Sort by month.

The order of the rows is part of the answer.

Database

My submissions