Write a query to calculate the rolling 7-day average of energy consumption per smart meter for EDF.
Use the meter_readings table. Treat each row as a meter reading for a date, retain dates whose consumption is NULL, and calculate averages from available non-NULL daily values.
meter_id, reading_date, daily_consumption, and rolling_7_day_avgmeter_id, then reading_date| Column | Type | Description |
|---|---|---|
| reading_idPK | INT | Unique identifier for the meter reading |
| meter_id | VARCHAR(20) | Smart meter identifier |
| reading_date | DATE | Date of the energy reading |
| consumption_kwh | NUMERIC(10,2) | Energy consumption in kilowatt-hours |