Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Aggregate Support Ticket Themes

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Aggregate Support Ticket Themes. Start with the requirements and the three tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

A support analytics team at Databricks wants a quick rollup of recurring ticket themes for April 2024. Write a SQL query to identify themes that appeared in at least 2 distinct tickets among tickets that were either open or resolved.

Requirements

  1. Only include tickets created from 2024-04-01 through 2024-04-30.
  2. Only include tickets with status open or resolved.
  3. Only include theme rows where theme_name is not null and confidence_score >= 0.75.
  4. Return, for each qualifying theme:
    • theme_name
    • ticket_count: number of distinct tickets with that theme
    • high_priority_count: number of distinct tickets with priority P1 or P2
  5. Keep only themes with ticket_count >= 2.
  6. Order by ticket_count descending, then high_priority_count descending, then theme_name ascending.

Schema

support_tickets
ColumnTypeDescription
ticket_idPKINTUnique support ticket identifier
customer_idINTCustomer account identifier
created_atDATEDate the support ticket was created
statusVARCHAR(20)Current ticket status
priorityVARCHAR(10)Ticket priority such as P1 or P2
product_areaVARCHAR(50)Databricks product area mentioned in the ticket
ticket_themes
ColumnTypeDescription
theme_idPKINTUnique extracted theme row identifier
ticket_idINTRelated support ticket identifier
theme_nameVARCHAR(100)Theme extracted from ticket text by a PySpark pipeline
confidence_scoreDECIMAL(4,2)Confidence score for the extracted theme
customers
ColumnTypeDescription
customer_idPKINTCustomer account identifier
account_nameVARCHAR(100)Customer account name
segmentVARCHAR(30)Customer segment
Tablessupport_ticketsticket_themescustomers
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results