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

SQL for Store Performance Insights

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze weekly store performance by region, joining sales, inventory, and labor tables to identify stores with declining sales and low in-stock rates at L.L. Bean.

Treat declining sales as a current weekly total below the prior week and low in-stock as a rate below 90%. Include only weeks with a prior sales week.

Output

  1. One row per store and week meeting both conditions
  2. Columns: region, store_id, week_start, weekly_sales, prior_week_sales, sales_decline_pct, in_stock_rate, and labor_hours
  3. Sort by region, store_id, and week_start ascending

Schema

weekly_sales
ColumnTypeDescription
sale_idPKINTUnique sales transaction identifier
store_idVARCHAR(10)L.L. Bean store identifier
regionVARCHAR(50)Store operating region
week_startDATEStart date of the sales week
net_salesDECIMAL(12,2)Net sales amount for the transaction
inventory
ColumnTypeDescription
store_idVARCHAR(10)L.L. Bean store identifier
regionVARCHAR(50)Store operating region
week_startDATEStart date of the inventory week
units_in_stockINTUnits available during the week
units_expectedINTUnits expected to be available during the week
labor
ColumnTypeDescription
labor_idPKINTUnique labor record identifier
store_idVARCHAR(10)L.L. Bean store identifier
regionVARCHAR(50)Store operating region
week_startDATEStart date of the labor week
labor_hoursDECIMAL(8,2)Labor hours recorded for the week
Tablesweekly_salesinventorylabor
Interviewer

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