Given a dataset of REVOLVE customer transactions, write a SQL query using window functions to compute a 7-day rolling average order value by customer segment.
Return one row for each customer segment and transaction date represented in the data. The rolling period includes the current date and the preceding six calendar days. Ignore NULL order values when calculating averages.
customer_segment, order_date, daily_order_value, rolling_7_day_avgcustomer_segment, then order_date ascending| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_segment | VARCHAR(50) | REVOLVE customer segment |
| order_date | DATE | Date on which the order was placed |
| order_value | NUMERIC(10,2) | Order value in US dollars |