EASYVerified Real Interview• Supply Chain Analyst
Low Stock Inventory Alert & Restock Priority
Verified Source:Walmart Global Tech Candidate Interview
Walmart's fulfillment center needs an automated alert system for products whose current inventory cannot cover the next 7 days of estimated demand.
Given:
daily_sales_rateis the average number of units sold per day.- A product is at risk if
current_inventory < (daily_sales_rate * 7).
Write a query to return:
product_idproduct_namecurrent_inventoryunits_shortage(defined as(daily_sales_rate * 7) - current_inventory)
Sort the output by units_shortage descending.
Table:
inventory(product_idINT,product_nameVARCHAR,current_inventoryINT,daily_sales_rateINT)
Execution Sandbox:
Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.
Standard SQL (ANSI)|Ln 1, Col 1(7 lines, 124 chars)
Tab Indent⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.