Restaurant Revenue Over Time
Restaurant management tracks revenue trends via rolling averages. For each day starting from the restaurant's 7th day of operation, compute the total customer spending over a 7-day window (current day + 6 previous) and the daily average. Output visited_on, amount, and average_amount — round the average to 2 decimal places.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| amount | visited_on | average_amount |
|---|---|---|
| 180 | 2024-01-07 | 180.00 |
| 400 | 2024-01-08 | 200.00 |
| 560 | 2024-01-09 | 186.67 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in