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 for Weekly Sales and Labor
00:00
5 left

SQL for Weekly Sales and Labor

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze weekly sales and labor efficiency by location at Delaware North, joining transactions, staffing, and calendar tables. Calculate total sales, total labor hours, sales per labor hour, and each location's efficiency rank within its week.

Output

  1. One row per location and calendar week.
  2. Include location_id, week_start, total_sales, labor_hours, sales_per_labor_hour, and efficiency_rank.
  3. Include locations appearing in either activity table, sort by week, rank, and location.

Schema

transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
location_idVARCHAR(20)Delaware North operating location
transaction_dateDATEDate of the transaction, matching calendar_date
sales_amountDECIMAL(12,2)Transaction sales amount
staffing
ColumnTypeDescription
staffing_idPKINTUnique staffing record identifier
location_idVARCHAR(20)Delaware North operating location
work_dateDATEDate labor was recorded, matching calendar_date
labor_hoursDECIMAL(10,2)Labor hours recorded for the location and date
calendar
ColumnTypeDescription
calendar_datePKDATEDaily calendar date
week_startDATEStart date of the reporting week
Tablestransactionsstaffingcalendar
Interviewer

Your question is SQL for Weekly Sales and Labor. 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.