Mercedes-Benz Group uses vehicle telemetry to monitor sensor anomalies across connected vehicles. Write a PostgreSQL query that calculates a calendar-aware rolling 7-day average of daily anomaly events for every registered vehicle.
vehicle_id to calculate the rolling average for the current date and preceding six dates.vehicle_id and report_date, with the average rounded to two decimal places.| Column | Type | Description |
|---|---|---|
| vehicle_idPK | VARCHAR(20) | Unique Mercedes-Benz vehicle identifier |
| model | VARCHAR(80) | Vehicle model |
| market | VARCHAR(40) | Vehicle sales market |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique anomaly event identifier |
| vehicle_id | VARCHAR(20) | Vehicle associated with the anomaly |
| event_timestamp | TIMESTAMP | Timestamp when the anomaly was recorded |
| anomaly_type | VARCHAR(50) | Anomaly classification, when available |