Your question is SQL Top 5 Renewal Policies. Start with the requirements and the three 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.
Root wants to compare renewal performance across its auto insurance policy plans. Write a PostgreSQL query that identifies the five policy plans with the highest renewal rate.
renewed outcomes divided by all completed renewal outcomes, including not_renewed.pending and NULL outcomes from the denominator.| Column | Type | Description |
|---|---|---|
| plan_idPK | INTEGER | Unique policy plan identifier |
| plan_name | VARCHAR(100) | Root auto policy plan name |
| coverage_tier | VARCHAR(30) | Coverage level |
| Column | Type | Description |
|---|---|---|
| policy_idPK | INTEGER | Unique policy identifier |
| plan_id | INTEGER | References policy_plans.plan_id |
| state | VARCHAR(2) | Policy state |
| policy_status | VARCHAR(20) | Current policy status |
| Column | Type | Description |
|---|---|---|
| renewal_idPK | INTEGER | Unique renewal record identifier |
| policy_id | INTEGER | References policies.policy_id |
| outcome | VARCHAR(20) | Renewal result |