Support Ticket Resolution Stats
Preview mode. Log in to edit, run, submit, and save progress.
Support Ticket Resolution Stats
You are given a table of support tickets. Each ticket has a priority level ('high', 'medium', or 'low'), a status ('resolved' or 'open'), a creation date, and an optional resolved date. Write a SQL query to find for each month and priority: the total number of tickets, the number of resolved tickets, the number of open tickets, and the resolution rate as a percentage (resolved / total × 100, rounded to 2 decimal places). Return the result ordered by month and priority. Table: Tickets
| Column Name | Type | Description |
|---|---|---|
| id | INT | Primary key |
| priority | VARCHAR | 'high', 'medium', or 'low' |
| status | VARCHAR | 'resolved' or 'open' |
| created_date | DATE | Date the ticket was opened |
| resolved_date | DATE | Date resolved (NULL if still open) |
Examples
Group by month and priority. Use CASE WHEN to count resolved and open separately. Resolution rate = resolved_count / total_tickets * 100.
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.