Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Compare Vendor and Queue Performance

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

Your question is Compare Vendor and Queue Performance. 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

You are given ticket-level operational data and need to compare performance across vendors and queues. Write a PostgreSQL query that returns each vendor and queue pair with the number of tickets handled, average handle time in minutes, and resolution rate for tickets created in the last 30 days. Exclude tickets that are still open, and sort the result by highest resolution rate, then lowest average handle time.

Schema

tickets
ColumnTypeDescription
ticket_idPKINTPrimary key for each ticket
vendor_idINTReferences the vendor that handled the ticket
queue_idINTReferences the queue the ticket was routed to
created_atTIMESTAMPTicket creation timestamp
closed_atTIMESTAMPTicket close timestamp, nullable if still open
statusVARCHAR(20)Ticket status such as open, closed, or pending
handle_time_minutesINTTime spent handling the ticket
vendors
ColumnTypeDescription
vendor_idPKINTPrimary key for each vendor
vendor_nameVARCHAR(100)Vendor name
queues
ColumnTypeDescription
queue_idPKINTPrimary key for each queue
queue_nameVARCHAR(100)Queue name
Tablesticketsvendorsqueues
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results