Your question is Rolling Average Claims Query. 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.
Texas Mutual Insurance needs a monthly view of reported claims by business unit. Write a PostgreSQL query that includes months with no claims and calculates a rolling average across the current month and the two preceding months.
| Column | Type | Description |
|---|---|---|
| business_unit_idPK | INTEGER | Unique business unit identifier |
| unit_name | VARCHAR(100) | Texas Mutual operating unit name |
| Column | Type | Description |
|---|---|---|
| claim_idPK | INTEGER | Unique claim identifier |
| business_unit_id | INTEGER | Business unit associated with the claim |
| reported_at | DATE | Date the claim was reported |
| claim_status | VARCHAR(30) | Current claim status |
| incurred_amount | NUMERIC(12,2) | Reported incurred amount |