
PUZZLE 69 LIFO-FIFO INVENTORY 283
PUZZLE
69 LIFO-FIFO INVENTORY
Imagine a very simple inventory of one kind of item, widgets, into which
we add stock once a day. This inventory is then used to fill orders that
also come in once a day. Here is the table for this toy problem:
CREATE TABLE WidgetInventory
(receipt_nbr INTEGER NOT NULL PRIMARY KEY,
purchase_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT
NULL,
qty_on_hand INTEGER NOT NULL
CHECK (qty_on_hand >= 0),
unit_price DECIMAL (12,4) NOT NULL);
with the following data:
WidgetInventory
receipt_nbr purchase_date qty_on_hand unit_price
================================================
1 '2005-08-01' ...