Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
SQL for Operational Performance
00:00
5 left

SQL for Operational Performance

MediumSQL · PostgreSQL

Problem

Carvana Operations Managers need a location-level view of market operations performance. Write a PostgreSQL query using Carvana market locations, completed orders, and recorded order errors.

Use 2025-02-15 as the reporting date, and analyze completed orders whose completed_at falls within the preceding 30 days, including both boundary dates.

Requirements

  1. Return every market location, including locations with no qualifying completed orders.
  2. Calculate completed order count and average cycle time in minutes.
  3. Calculate error rate as the percentage of completed orders with at least one associated error. Return 0.00 when a location has no completed orders.
  4. Sort results alphabetically by location name.

Schema

market_locations
ColumnTypeDescription
location_idPKINTEGERUnique market location identifier
location_nameVARCHAR(100)Carvana market location name
orders
ColumnTypeDescription
order_idPKINTEGERUnique order identifier
location_idINTEGERMarket location handling the order
statusVARCHAR(20)Current order status
created_atDATEDate the order was created
completed_atDATEDate the order was completed
cycle_time_minutesINTEGEROperational cycle time in minutes
order_errors
ColumnTypeDescription
error_idPKINTEGERUnique error record identifier
order_idINTEGEROrder associated with the error
error_typeVARCHAR(50)Operational error category
Tablesmarket_locationsordersorder_errors
Interviewer

Your question is SQL for Operational Performance. 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.