Urgent email and phone tickets by team, with unassigned
The task
The support lead reviews urgent tickets that came in by email or phone (priority = 'urgent' and channel is 'email' or 'phone') and how happy customers were.
Group these tickets by the team of the assigned agent (agents.team). A ticket with no assigned agent (agent_id IS NULL) must not be dropped: group those under the label 'unassigned'.
Return:
teamtickets: number of ticketssurveyed: how many of those tickets have a row insatisfactionavg_score: averagescoreof the surveyed tickets, rounded to 2 decimal places, or NULL if none were surveyed
Sort by team.
Expected output
teamticketssurveyedavg_score- Sorted by team ascending.
- Numbers rounded to 2 decimal places.
- Checked on the sample and on 2 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
- April spend and cost per click for search and socialeasy
- Email-referred customers and their completed orderseasy
- Headcount by department, empty and unassigned includedeasy
- Invoiced amount by the plan active on the issue datemedium
- Spending by merchant partner group, NULL merchants includedmedium
- Tickets per response band from a band lookup tablemedium
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL