Write a SQL query using window functions to rank policies by premium within each state for Plymouth Rock Assurance.
Use the provided policies and states tables. Policies with a NULL premium are ignored, and only policies associated with a known state are included.
policy_id, policy_number, state_code, premium, and premium_rank.state_code, premium_rank, and policy_id ascending.| Column | Type | Description |
|---|---|---|
| state_codePK | VARCHAR(20) | State or jurisdiction code |
| state_name | VARCHAR(100) | Full state name |
| Column | Type | Description |
|---|---|---|
| policy_idPK | INT | Unique policy identifier |
| policy_number | VARCHAR(30) | Business policy number |
| state_code | VARCHAR(20) | State code associated with the policy |
| premium | NUMERIC(12,2) | Policy premium amount |