Given a relational schema containing patient transaction records and provider registries, write a SQL query to calculate the rolling 30-day average of transactions per provider. Treat the metric as the average daily transaction count for the current date and prior 29 calendar days. Include every registered provider and every calendar date between the minimum and maximum transaction dates, including zero-activity dates.
provider_id, then report_date.provider_id, provider_name, report_date, transaction_count, and rolling_30_day_avg.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique patient transaction identifier |
| patient_id | INTEGER | Identifier of the patient associated with the transaction |
| provider_id | INTEGER | Provider identifier associated with the transaction |
| transaction_date | DATE | Calendar date on which the transaction occurred |
| Column | Type | Description |
|---|---|---|
| provider_idPK | INTEGER | Unique provider identifier |
| provider_name | VARCHAR(100) | Provider display name |
| registry_status | VARCHAR(20) | Current registry status |