Tickets per response band from a band lookup table
The task
The support team reports how fast it answers. The response time of a ticket is the time from created_at to first_response_at, in minutes (fractions allowed). Each ticket falls into one band; the lower limit is included and the upper limit is not:
band_rank |
band |
from (minutes) | up to (minutes) |
|---|---|---|---|
| 1 | 'under_15m' |
0 | 15 |
| 2 | '15m_to_1h' |
15 | 60 |
| 3 | '1h_to_24h' |
60 | 1440 |
| 4 | 'over_24h' |
1440 | no limit |
| 5 | 'no_response' |
tickets with first_response_at NULL |
Return one row for every band, including bands with no tickets:
band_rankbandtickets: number of tickets in the band
Sort by band_rank.
Expected output
band_rankbandtickets- Sorted by band_rank ascending.
- 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
- Trips from brand-new riders, by cityeasy
- Agent by month fact table of tickets created and resolvedmedium
- Daily spend against sign-ups for one campaignhard
- Free and paid listeners per genremedium
- Invoiced amount by the plan active on the issue datemedium
- Open accounts at each month end, by account typehard
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL