Plymouth Rock Assurance wants to compare customer premium totals within each state for its Personal Lines portfolio. Write a PostgreSQL query that ranks customers by the total annual premium from their active policies.
RANK(), with the highest total premium receiving rank 1. Customers tied on premium must share the same rank.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer full name |
| state_code | CHAR(2) | Two-letter state of residence |
| Column | Type | Description |
|---|---|---|
| policy_idPK | INTEGER | Unique policy identifier |
| customer_id | INTEGER | Customer associated with the policy |
| annual_premium | NUMERIC(12,2) | Annual premium amount |
| policy_status | VARCHAR(20) | Current policy status |