Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Store Ops Performance
00:00
5 left

SQL for Store Ops Performance

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze store operations performance by week, joining sales, inventory, and labor tables to identify locations with high shrink and low recovery scores at Michaels.

Use a shrink rate above 2% and a recovery score below 70 as the identification thresholds. Include prior-week comparisons when available.

Output

  1. One row per qualifying store and week.
  2. Return store_id, week_start, net_sales, shrink_value, shrink_rate, recovery_score, labor_hours, prior_week_shrink_rate, and recovery_score_change.
  3. Sort by week_start ascending, shrink_rate descending, and store_id ascending.

Schema

sales
ColumnTypeDescription
sale_idPKINTUnique sale identifier
store_idINTMichaels store identifier
sale_dateDATEDate of the sale
net_salesNUMERIC(12,2)Net sales amount
inventory
ColumnTypeDescription
inventory_idPKINTUnique inventory record identifier
store_idINTMichaels store identifier
inventory_dateDATEDate of the inventory observation
shrink_valueNUMERIC(12,2)Value of inventory shrink
recovery_scoreNUMERIC(5,2)Inventory recovery score from 0 to 100
labor
ColumnTypeDescription
labor_idPKINTUnique labor record identifier
store_idINTMichaels store identifier
labor_dateDATEDate the labor was recorded
hours_workedNUMERIC(8,2)Labor hours worked
Tablessalesinventorylabor
Interviewer

Your question is SQL for Store Ops Performance. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.