amount for each visited_on date.amount over a 7-day window using window functions with the ROWS BETWEEN 6 PRECEDING AND CURRENT ROW frame.ROW_NUMBER() window function to assign a sequential integer to each row, ordered by visited_on.visited_on, rolling sum as amount, and the rounded rolling average as average_amount from the second CTE.visited_on in ascending order.
erDiagram
Customer {
int customer_id
varchar name
date visited_on
int amount
}