Re: MySQL design problem for tracking inventory
Date: 11 Mar 2005 18:54:07 -0800
Message-ID: <1110596047.286317.188900_at_z14g2000cwz.googlegroups.com>
> ... any thoughts or suggestions ...
Below script models a few inventory items using a small experimental db (XDb3) that accepts new products with new option at run time. Db takes care of schema/normalization on the fly. Similar could be performed with RMDB using generic modelling.
// Create directory items to organize things.
(CREATE dir item *product) (CREATE dir item *"ski jacket") (CREATE dir item *size) (CREATE dir item *color) (CREATE dir item *qty)
// Create 1000 small-black ski jackets
(CREATE "ski jacket" inst *
& product inst it
& it size +small
& it color +black
& it qty +1000)
// Create 2000 small-red ski jackets
(CREATE "ski jacket" inst *
& product inst it
& it size +small
& it color +red
& it qty +2000)
// Create 3000 small-blue ski jackets
(CREATE "ski jacket" inst *
& product inst it
& it size +small
& it color +blue
& it qty +3000)
// Add new product type: socks
(CREATE dir item *socks)
// Add new option: material
(CREATE dir item *material)
// Create 100 small-cotton socks
(CREATE socks inst *
& product inst it
& it size +small
& it material +cotton
& it qty +100)
// Create 200 blue-silk socks
(CREATE socks inst *
& product inst it
& it color +blue
& it material +silk
& it qty +200)
// Create 300 cotton/polyester socks
(CREATE socks inst *
& product inst it
& it material +cotton
& it material +polyester
& it qty +300)
// Find all products that are blue.
// Finds small-blue ski jacket and blue-silk socks.
(SELECT product inst *
& * color blue)
Received on Sat Mar 12 2005 - 03:54:07 CET