Week-over-week high-priority tickets
The task
The support lead watches how many serious tickets arrive each week.
A serious ticket has priority of high or urgent. Weeks are ISO weeks: they start on Monday and end on Sunday, and each is identified by its Monday.
For each week starting from Monday 2025-02-10 through Monday 2025-06-23 (20 weeks), return:
week_start: the Monday of the weektickets: serious tickets withcreated_atin that week (from Monday 00:00 up to the next Monday 00:00), 0 if noneprev_tickets: the same count for the previous weekchange_pct: the change from the previous week as a percentage of the previous week, rounded to 1 decimal place, or NULL when the previous week had no tickets
Sort by week_start ascending.
Expected output
week_startticketsprev_ticketschange_pct- Sorted by week_start ascending.
- Numbers rounded to 1 decimal place.
- 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
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL