Ticket categories with an above-average urgent share
The task
The support lead wants to know which ticket categories are more urgent than the desk as a whole.
- A category's urgent share is its tickets with
priority = 'urgent'divided by all its tickets. - The overall urgent share is urgent tickets divided by all tickets, across every category.
Return the categories whose urgent share is strictly greater than the overall urgent share. Compare the exact ratios, not rounded ones. Give category, tickets (all tickets in the category), urgent_pct and overall_urgent_pct, both as percentages rounded to 1 decimal place. Sort by category.
Expected output
categoryticketsurgent_pctoverall_urgent_pct- Sorted by category ascending.
- Numbers rounded to 1 decimal place.
- Checked on the sample and on 3 hidden datasets. How grading works
Tables Customer support desk · click a name to insert it
agents14 rows in the sample
Support agents. Key: agent_id.
| int | Unique id. | |
| text | Name. | |
| text | billing, technical or general. | |
| date | Start day. |
tickets900 rows in the sample
One row per ticket. Key: ticket_id.
| int | Unique id. | |
| int | Who opened it. | |
| int | Assigned agent. NULL if never assigned. | |
| text | email, chat or phone. | |
| text | low, normal, high or urgent. | |
| text | billing, bug, how_to or account. | |
| timestamp | Opened (UTC). | |
| timestamp | First reply from an agent. NULL if none yet. | |
| timestamp | Closed as solved. NULL while open. |
satisfaction366 rows in the sample
Survey answers, at most one per ticket. Key: ticket_id.
| int | The ticket. | |
| int | 1 (very unhappy) to 5 (very happy). | |
| timestamp | When answered (UTC). |
Related questions
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL