Write a SQL query utilizing window functions to calculate a rolling 7-day average of production output.
Use the production_output table. Treat dates without production records and NULL output values as zero. The rolling average should include the current date and the six preceding calendar dates.
production_date, daily_output, and rolling_7_day_average.production_date ascending.| Column | Type | Description |
|---|---|---|
| production_idPK | INT | Unique production record identifier |
| production_date | DATE | Date of production |
| output_units | NUMERIC(10,2) | Units produced in the record |