Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Top Technicians Query
00:00
5 left

Top Technicians Query

MediumSQL · PostgreSQL

Problem

Write a query to identify top-performing service technicians based on historical job data at ServiceTitan. Include only technicians with at least two completed jobs, and rank them by total completed job revenue.

Output

  1. One row per technician in the top three ranking positions, including ties
  2. Columns: technician_name, completed_jobs, total_revenue, average_rating, and performance_rank
  3. Sort by performance_rank ascending, then technician_name ascending

Schema

technicians
ColumnTypeDescription
technician_idPKINTUnique technician identifier
technician_nameVARCHAR(100)Technician display name
tradeVARCHAR(50)Primary service trade
job_assignments
ColumnTypeDescription
assignment_idPKINTUnique assignment identifier
job_idINTAssigned job identifier
technician_idINTAssigned technician identifier
assigned_atDATEDate the job was assigned
jobs
ColumnTypeDescription
job_idPKINTUnique job identifier
statusVARCHAR(20)Current job status
completed_atDATEDate the job was completed
revenueNUMERIC(12,2)Revenue generated by the job
customer_ratingNUMERIC(2,1)Optional customer rating from one to five
Tablestechniciansjob_assignmentsjobs
Interviewer

Your question is Top Technicians Query. Start with the requirements and the three tables in the Question tab.

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.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.