There’s No Stock Column: Inventory Computed in SQL on Every Read
In this inventory system, the most important number, remaining stock, isn’t stored in any table. Here’s a dissection of the SQL that computes it on every read, and the store-versus-compute trade-off behind that design.