Slowest ticket per project

ranking

Slowest ticket per project

Atlassian SQL Interview Question

Averages hide the tickets that damage a team's reputation. One item that sat for three weeks is what a customer remembers and what gets raised in a quarterly review, while forty quick fixes around it pull the average down. Each project lead reviews their single worst case, and a ticket still open has no duration yet.

For each project, return the project, the ticket_id that took longest to resolve, and the number of days it took as days_open.

Asked of

  • Data Analyst
  • Business Analyst
  • BI Analyst
  • Product Analyst
  • Analytics Engineer
  • Data Engineer
  • Data Scientist

atlassian_ticketsTable24 rows

Column NameType
ticket_idBIGINT
parent_ticket_idBIGINT
projectVARCHAR
opened_onDATE
resolved_onDATE
priorityVARCHAR
assignee_idBIGINT

atlassian_ticketsExample Input

ticket_idparent_ticket_idprojectopened_onresolved_onpriorityassignee_id
2001NULLJira Cloud2024-02-012024-02-14P111
20022001Jira Cloud2024-02-022024-02-06P212
20032001Jira Cloud2024-02-032024-02-11P213
20042001Jira Cloud2024-02-05NULLP312
2005NULLJira Cloud2024-02-042024-02-09P214
20062005Jira Cloud2024-02-052024-02-08P311
2014NULLBitbucket2024-02-012024-02-03P317
2015NULLBitbucket2024-02-052024-02-22P118
20162015Bitbucket2024-02-062024-02-13P217

Example Output

projectticket_iddays_open
Bitbucket201517
Jira Cloud200113

Explanation

Bitbucket's worst case is 2015 at 17 days and Jira Cloud's is 2001 at 13. Tickets still open have no resolution date and so no duration, which is why they are left out rather than sorted to one end.

The example above is a small slice of the data. Your query runs against the full tables.