Write a SQL query to find the average time-to-settlement for cases grouped by state and case type, filtering out any states with fewer than 50 cases.
Use the cases table. Calculate time-to-settlement from opened_at and settled_at, and exclude cases without a settlement date.
state, case_type, and average_time_to_settlement_days.state, then case_type.| Column | Type | Description |
|---|---|---|
| case_idPK | INT | Unique case identifier |
| state | VARCHAR(2) | Two-letter state code |
| case_type | VARCHAR(50) | Case classification |
| opened_at | TIMESTAMP | Timestamp when the case was opened |
| settled_at | TIMESTAMP | Timestamp when the case was settled |