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

SQL Store Performance Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze store performance by joining sales, labor, and inventory tables and summarizing key operational metrics by store and week for Walgreens.

Return all store-week combinations found in any source table. Use the available data to calculate the requested metrics and handle missing source records appropriately.

Output

  1. One row per store and week, ordered by store_id, then week_start.
  2. Columns: store_id, week_start, sales_units, sales_revenue, labor_hours, labor_cost, avg_inventory_units, stockout_days, and revenue_per_labor_hour.

Schema

sales
ColumnTypeDescription
sale_idPKINTUnique sales record identifier
store_idINTWalgreens store identifier
week_startDATEStart date of the reporting week
units_soldINTUnits sold, including negative return quantities
sales_amountDECIMAL(12,2)Sales revenue for the record
labor
ColumnTypeDescription
labor_idPKINTUnique labor record identifier
store_idINTWalgreens store identifier
week_startDATEStart date of the reporting week
hours_workedDECIMAL(8,2)Employee hours worked
labor_costDECIMAL(12,2)Labor cost for the record
inventory
ColumnTypeDescription
inventory_idPKINTUnique inventory observation identifier
store_idINTWalgreens store identifier
week_startDATEStart date of the reporting week
on_hand_unitsINTObserved units available in inventory
Tablessaleslaborinventory
Interviewer

Your question is SQL Store Performance Analysis. 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.