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 Store Metrics
00:00
5 left

SQL for Weekly Store Metrics

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze weekly store performance by joining sales, labor, and inventory tables and calculating key operational metrics.

Use the provided tables and include January 2025 activity. Combine records at the store-week level and preserve weeks that appear in any source table.

Output

  1. One row per store and week, ordered by store_id, then week_start.
  2. Return store_id, week_start, weekly_sales, transaction_count, units_sold, labor_hours, sales_per_labor_hour, sell_through_rate, ending_inventory_units, prior_week_sales, and sales_change_pct.
  3. Use NULL when a metric cannot be calculated because its denominator or source data is unavailable.

Schema

sales
ColumnTypeDescription
sale_idPKINTUnique sale record identifier
store_idVARCHAR(10)Ross Stores store identifier
sale_dateDATEDate of the sales activity
transaction_countINTNumber of customer transactions
units_soldINTUnits sold during the record period
net_salesDECIMAL(12,2)Net sales dollars
labor
ColumnTypeDescription
labor_idPKINTUnique labor record identifier
store_idVARCHAR(10)Ross Stores store identifier
work_dateDATEDate labor was recorded
labor_hoursDECIMAL(8,2)Hours worked at the store
inventory
ColumnTypeDescription
inventory_idPKINTUnique inventory snapshot identifier
store_idVARCHAR(10)Ross Stores store identifier
snapshot_dateDATEDate of the inventory snapshot
beginning_unitsINTUnits available at the beginning of the period
received_unitsINTUnits received during the period
ending_unitsINTUnits available at the end of the period
Tablessaleslaborinventory
Interviewer

Your question is SQL for Weekly Store Metrics. 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.