EASYVerified Real Interview• Supply Chain Analyst

Low Stock Inventory Alert & Restock Priority

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_rate is 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_id
  • product_name
  • current_inventory
  • units_shortage (defined as (daily_sales_rate * 7) - current_inventory)

Sort the output by units_shortage descending.

Table:

  • inventory (product_id INT, product_name VARCHAR, current_inventory INT, daily_sales_rate INT)

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
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.