Calculate stock available after reservations Original fictional practice data · 2026-11-11 · CC BY 4.0 BRIEF A store needs an availability file for tomorrow morning. Combine on-hand stock, active reservations and eligible inbound units without multiplying rows. CONTRACT 1. Include inbound ETA on or before 2026-11-12 and active reservations only. 2. Aggregate reservations and inbound independently per SKU; calculate on-hand + eligible inbound - reserved. 3. Keep negative availability as a shortage signal. Return sku,available_units sorted by sku. METHOD Calculate INK reservations as 8 and eligible inbound as 4. Aggregate each many-side table before joining the SKU master. Keep TAPE at -3 so the replenishment team can see the oversell. COMMON MISTAKE Clamping shortages to zero hides the magnitude of the reservation problem. INDEPENDENT CROSS-CHECK Total availability is 78 units. The negative TAPE row must remain. DELIVER A checked output CSV and a handoff note explaining the exception policy. Use setup.sql in SQLite or import each table CSV into your spreadsheet. expected.csv is the complete reference result; an empty CSV field represents SQL NULL. The browser executes SQLite, not Excel formulas. XLOOKUP is unavailable in Excel 2016 and 2019. Sources for function behavior: https://www.sqlite.org/lang_select.html and https://support.microsoft.com/en-us/excel/functions/xlookup-function (checked 2026-11-11). Rates, dates and policies here are exercise assumptions.