An insurer uses claims data to support portfolio analysis. Write a PostgreSQL query that joins policy records to claim events and summarizes 2025 claims by policy segment.
LEFT JOIN from policies to claim_events, retaining policy segments with no qualifying 2025 claims.state_code and policy_type.NULL states last, then by policy type.state_code, policy_type, policy_count, claim_count, and total_incurred, in that order.state_code ascending with NULL values last, then policy_type ascending with NULL values last.reported_date >= DATE '2025-01-01' and reported_date < DATE '2026-01-01'.policy_count, claim_count, and total_incurred as the output column names.| Column | Type | Description |
|---|---|---|
| policy_idPK | INT | Unique policy identifier |
| state_code | VARCHAR(2) | Two-letter policy state |
| policy_type | VARCHAR(30) | Insurance line of business |
| Column | Type | Description |
|---|---|---|
| claim_idPK | INT | Unique claim identifier |
| policy_id | INT | Policy associated with the claim |
| reported_date | DATE | Date the claim was reported |
| incurred_amount | DECIMAL(12,2) | Current incurred loss amount |
| status | VARCHAR(20) | Claim processing status |