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
Promotional Inventory Performance SQL
00:00
5 left

Promotional Inventory Performance SQL

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze promotional inventory performance by brand and week, including stockouts, excess inventory, and sell-through rate.

Use the supplied brand, promotion, and weekly inventory data. Include promotional weeks even when no inventory record exists, and treat unavailable sell-through denominators as NULL.

Output

  1. One row per promotional brand and week
  2. Columns: brand_name, week_start, promotion_name, stockout_days, excess_inventory_units, and sell_through_rate
  3. Sell-through rate is a percentage, rounded to two decimals
  4. Sort by week_start, then brand_name

Schema

brands
ColumnTypeDescription
brand_idPKINTUnique brand identifier
brand_nameVARCHAR(100)Brand name
promotions
ColumnTypeDescription
promotion_idPKINTUnique promotion identifier
brand_idINTBrand participating in the promotion
week_startDATEMonday starting the promotional week
promotion_nameVARCHAR(100)Promotion name
inventory_weekly
ColumnTypeDescription
inventory_idPKINTUnique inventory record identifier
promotion_idINTRelated promotion
store_codeVARCHAR(20)Store or distribution location code
beginning_inventoryINTUnits available at the beginning of the week
units_receivedINTUnits received during the week
units_soldINTUnits sold during the week
stockout_daysINTNumber of days the promotional item was out of stock
excess_inventory_unitsINTUnits identified as excess inventory
Tablesbrandspromotionsinventory_weekly
Interviewer

Your question is Promotional Inventory Performance SQL. 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.