假设我有一个由三个主要项目组成的产品。产品是膝上型电脑,项目是:螺丝(id,代码,描述)按钮(id,代码,描述)覆盖(id,代码,描述,颜色)。
每台膝上型电脑都由这些项目的任意组合组成。
发布于 2013-03-04 20:51:48
/* keep your general product specs here: */
PRODUCT
id primary key
type
code
description
standard_price
/* or add a subtype table for some of them: */
COVERAGE_PRODUCT
id pk fk PRODUCT
colour
/* products are composed of other products: */
PRODUCT_STRUCTURE
part_of not null references product(id),
composed_of not null references product(id)
primary key (part_of, composed_of)您可以将历史定价保留在数据仓库中,或者添加一个product_price表。在这种情况下,从产品中删除"standard_price“。
PRODUCT_PRICE
product_id fk product(id)
from_date
price
to_date (nullable)
primary key (product_id, from_date)https://stackoverflow.com/questions/15206203
复制相似问题