我正在为零售业务设计一个数据库。有些产品可以以多个单位出售,例如,铅笔可以以一支和打出售,纸张可以以张、令和广单位出售。基本上,每种产品都可以以多个单位出售。
软件需要支持
以下是我的初步设计。
Table Products
ProductId | Barcode | Name | CurrentPriceId
1 | XXXX | Pencil | 1
Table Prices
Id | Amount
1 | 0.49
Table Units
UnitId | Name
1 | Ea
2 | Box
Table UnitConverter
ProductId | FromUnitId | Multiplier | ToUnitId |
1 | 1 | 24 | 2 | // 24 pencils equals 1 box
Table Inventories
Id | ProductId | UnitId …
Run Code Online (Sandbox Code Playgroud)