Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Median Defect Resolution Time
00:00
5 left

Median Defect Resolution Time

HardSQL · PostgreSQL

Problem

Apex Systems wants to monitor how quickly defects are resolved across its QA teams. Write a PostgreSQL query that calculates resolution-time statistics for defects opened during January 2024.

Requirements

  1. Derive each defect's first transition to Resolved from defect_status_history.
  2. Calculate the number of resolved defects, average resolution time, median resolution time, and 90th percentile resolution time in hours.
  3. Group results by QA team and defect severity.
  4. Include comma-separated project and owner names, preserving defects with no assigned owner.
  5. Exclude unresolved defects, invalid negative durations, and defects opened outside January 2024. Sort by QA team and severity.

Schema

projects
ColumnTypeDescription
project_idPKINTUnique project identifier
project_nameVARCHAR(100)Apex Systems project name
qa_teamVARCHAR(100)QA team responsible for the project
engineers
ColumnTypeDescription
engineer_idPKINTUnique QA engineer identifier
engineer_nameVARCHAR(100)QA engineer's name
roleVARCHAR(50)QA engineering role
defects
ColumnTypeDescription
defect_idPKINTUnique defect identifier
project_idINTReferences projects.project_id
assigned_engineer_idINTReferences engineers.engineer_id
severityVARCHAR(20)Defect severity classification
opened_atTIMESTAMPTimestamp when the defect was opened
current_statusVARCHAR(30)Current lifecycle status
defect_status_history
ColumnTypeDescription
history_idPKINTUnique status history identifier
defect_idINTReferences defects.defect_id
statusVARCHAR(30)Status recorded in the history event
changed_atTIMESTAMPTimestamp when the status changed
Tablesprojectsengineersdefectsdefect_status_history
Interviewer

Your question is Median Defect Resolution Time. Start with the requirements and the four 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.