Northwind
a sibling on SQL Server
dbo.GetReorderCandidates
What needs reordering?
Active products with a shortage: reorder level minus stock and units on order.
Shortage = reorder level − (units in stock + units on order)
Active products only, shortage > 0. NULL = 0. Order: ID.
Synthetic fixture
One: 12 − (3 + 4) = 5Two: 9 − (1 + 2) = 6
Expected result
| ID | Name | Shortage |
|---|---|---|
| 1 | One | 5 |
| 2 | Two | 6 |
Synthetic example. No SQL Server, AI roles or Git are run. You can see a sibling on SQL Server in the planveyor-mssql repository (in Russian).