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
SQL Performance by Location
00:00
5 left

SQL Performance by Location

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by location, including daily volume, average processing time, and week-over-week change.

Use completed processing jobs with valid start and completion timestamps. Exclude cancelled or incomplete jobs. Week-over-week change should compare each location's completed-job volume for the current calendar week with the previous calendar week.

Output

  1. One row per location and date with completed jobs
  2. Columns: location_name, work_date, daily_volume, avg_processing_minutes, and week_over_week_change_pct
  3. Include the current and previous weekly volumes only through the calculated percentage, return NULL when no prior-week volume exists, and order by location name then date

Schema

locations
ColumnTypeDescription
location_idPKINTUnique location identifier
location_nameVARCHAR(100)Operational location name
location_codeVARCHAR(20)Short operational location code
service_types
ColumnTypeDescription
service_type_idPKINTUnique service type identifier
service_type_nameVARCHAR(100)Type of staffing operation processed
target_minutesINTTarget processing time in minutes
processing_jobs
ColumnTypeDescription
job_idPKINTUnique processing job identifier
location_idINTLocation where the job was processed
service_type_idINTType of processing operation
statusVARCHAR(20)Processing status
started_atTIMESTAMPTimestamp when processing began
completed_atTIMESTAMPTimestamp when processing completed
Tablesprocessing_jobslocationsservice_types
Interviewer

Your question is SQL Performance by Location. 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.