Your question is SQL Rolling Average Window. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The IRS Submission Processing program monitors how quickly processing centers complete tax returns. Analysts need a monthly view and a smoothed three-month trend for each center.
Write a PostgreSQL query to calculate the monthly average processing time and the three-month rolling average for each IRS processing center.
status = 'Processed' submitted from January through May 2025.| Column | Type | Description |
|---|---|---|
| center_idPK | INTEGER | Unique processing center identifier |
| center_name | VARCHAR(100) | IRS processing center name |
| state_code | CHAR(2) | State abbreviation for the center |
| Column | Type | Description |
|---|---|---|
| return_idPK | INTEGER | Unique tax return identifier |
| center_id | INTEGER | Processing center assigned to the return |
| submitted_at | DATE | Date the return was submitted |
| status | VARCHAR(20) | Current processing status |
| processing_days | INTEGER | Elapsed days required to process the return |