我有这个相当基本的关系模型来存储自行车模型。它包含2个表:
(modelID, modelName, brandName)
(modelID, type, color, wheelSize, suspension, frameMaterial, brakeManufacturer, gearType, gearModel, yearProduced)
我被要求将其改编为维度模型。
这些是维度表:
tbl_d_model(modelID, modelName)
tbl_d_brand(brandID, brandName)
tbl_d_color(colorID, color)
tbl_d_type(typeID, type)
tbl_d_wheel(wheelID, wheelSize)
tbl_d_suspension(suspID, suspension)
tbl_d_frameMat(frameID, frameMaterial)
tbl_d_brakeMan(brakeId, brakeManufacturer)
tbl_d_gear(gearID, gearType, gearModel)
这就是事实表:
tbl_f_fact(modelID, brandID, colorID, typeID, wheelID, suspID, frameID, brakeID, gearID, yearProduced)
这是最佳方式吗?还有更好的方法吗?
答案 0 :(得分:1)
在尺寸建模上使用按键。
您需要的是单个维度,而不是10个维度和事实表。
因此
dimension_bycicle(key_bicicle, modelName, brandName, type, color, wheelSize, suspension, frameMaterial, brakeManufacturer, gearType, gearModel, yearProduced, modelId)
请注意,modelId是您的自然键(操作系统密钥,不应用作数据仓库密钥)。