Write a SQL query using window functions to calculate each customer's 7-day rolling average order value.
Use the customers and orders tables. Include only orders with a matching customer and a non-null order date. The rolling period includes the order date and the six preceding calendar days. Null order values should not contribute to the average.
customer_id, customer_name, order_id, order_date, order_value, and rolling_avg_order_value.customer_id, order_date, and order_id ascending.| Column | Type | Description |
|---|---|---|
| customer_idPK | VARCHAR(10) | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | VARCHAR(10) | Customer who placed the order |
| order_date | DATE | Calendar date when the order was placed |
| order_value | NUMERIC(10,2) | Value of the order |