Skip to content

Week-over-week high-priority tickets

MediumFull bankPeriod over periodDates and time15 min2 hidden datasets

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 week
  • tickets: serious tickets with created_at in that week (from Monday 00:00 up to the next Monday 00:00), 0 if none
  • prev_tickets: the same count for the previous week
  • change_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.

intUnique id.
textName.
textbilling, technical or general.
dateStart day.
tickets900 rows in the sample

One row per ticket. Key: ticket_id.

intUnique id.
intWho opened it.
intAssigned agent. NULL if never assigned.
textemail, chat or phone.
textlow, normal, high or urgent.
textbilling, bug, how_to or account.
timestampOpened (UTC).
timestampFirst reply from an agent. NULL if none yet.
timestampClosed as solved. NULL while open.
satisfaction366 rows in the sample

Survey answers, at most one per ticket. Key: ticket_id.

intThe ticket.
int1 (very unhappy) to 5 (very happy).
timestampWhen answered (UTC).

Related questions

Loading the editor and PostgreSQL