Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Identify High-Ticket Inactive Customers

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

Your question is Identify High-Ticket Inactive Customers. 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

At Autodesk, the support team wants to find customers who generated a high number of support tickets in May 2024 but did not log into Autodesk Fusion during that same month.

Write a SQL query to return customers who meet these conditions.

Requirements

  1. Count support tickets submitted in May 2024 for each customer.
  2. Keep only customers with more than 3 tickets in that month.
  3. Exclude any customer who had an Autodesk Fusion login in May 2024.
  4. Return the customer's most recent Autodesk Fusion login before 2024-05-01. If none exists, return NULL.
  5. Order the result by ticket_count_past_month descending, then last_login_at ascending with NULLS FIRST.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer full name
account_statusVARCHAR(30)Current account status
support_tickets
ColumnTypeDescription
ticket_idPKINTUnique support ticket identifier
customer_idINTCustomer who submitted the ticket
product_nameVARCHAR(100)Product associated with the ticket
submitted_atTIMESTAMPTicket submission timestamp
issue_typeVARCHAR(50)Support issue category
login_events
ColumnTypeDescription
login_idPKINTUnique login event identifier
customer_idINTCustomer who logged in
product_nameVARCHAR(100)Product used during login
login_atTIMESTAMPLogin timestamp
device_typeVARCHAR(30)Device used for login
Tablescustomerssupport_ticketslogin_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results