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 Retail Sales Analysis
00:00
5 left

SQL Retail Sales Analysis

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze NIKE retail sales by store, product, and week, including joins across sales, inventory, and store dimension tables.

Return all sales combinations associated with a known Nike store. Preserve sales rows without a matching inventory snapshot and classify inventory status based on available units.

Output

  1. One row per store, product, and calendar week, with columns store_id, store_name, region, product_id, week_start, total_units_sold, total_sales, ending_inventory_units, and inventory_status.
  2. Include missing inventory as a visible result, and order by store_id, week_start, and product_id.

Schema

nike_sales
ColumnTypeDescription
sale_idPKINTUnique retail sale identifier
store_idINTNike store that recorded the sale
product_idVARCHAR(20)Nike product identifier
sale_dateDATEDate on which the sale occurred
units_soldINTNumber of units sold
net_salesDECIMAL(12,2)Net sales amount in local reporting currency
nike_inventory
ColumnTypeDescription
inventory_idPKINTUnique inventory snapshot identifier
store_idINTStore holding the inventory
product_idVARCHAR(20)Nike product identifier
week_startDATEMonday starting the inventory week
ending_unitsINTUnits available at the end of the week
nike_store_dim
ColumnTypeDescription
store_idPKINTUnique Nike store identifier
store_nameVARCHAR(100)Nike store display name
regionVARCHAR(50)Geographic sales region
Tablesnike_salesnike_inventorynike_store_dim
Interviewer

Your question is SQL Retail Sales 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.