事实 table 应该有来自 'weak entity' 的度量,或者只应输入父实体的字段
fact table should have measures from 'weak entity' or only parent entity's fields should be entered
我是维度建模和 OLAP 的新手。
我正在尝试为商店创建维度模型。
"order" table 有列:
'order_id(auto generated), total_order_cost, date, product_Set_Id'.
"Product_set" table(包含每个订单中订购的产品,即每个订单的多行,tables 由 'product_set_id' 列逻辑链接)有列:
'product_set_id, product_name, quantity,Cost_per_quantity'.
在 ER 模型中 "product_set" table 是一种依赖于 "order" table.
的弱实体
我怀疑的是事实table
情况 1:我应该只添加 'order_id(fk)'
和 'total_order_cost(as measure)'
==>在这种情况下 "product_set" 的测量实际上不会存在 table.
或者大小写2:i应该加上'order_id(fk)','product_set_id(fk)' and 'cost_per_quantity(measure), quantity(measure), total_order_cost(measure)'
==>在这种情况下,相同的 'order_id' and 'total_order_cost'
会有多行
还有其他一些 table 像 "customer" 等,但我对上面提到的有疑问。
提前致谢!
总是提出的一个建议是在表上创建一个代理键。我的事实 sales 是这样的,它有代理键,允许我在那里有订单数据,每个订单都由代理键标识(我并没有真正使用 - 但它不是问题)。这样你就可以按照案例 2 进行操作。
这是否回答了问题?
我是维度建模和 OLAP 的新手。 我正在尝试为商店创建维度模型。
"order" table 有列:
'order_id(auto generated), total_order_cost, date, product_Set_Id'.
"Product_set" table(包含每个订单中订购的产品,即每个订单的多行,tables 由 'product_set_id' 列逻辑链接)有列:
'product_set_id, product_name, quantity,Cost_per_quantity'.
在 ER 模型中 "product_set" table 是一种依赖于 "order" table.
的弱实体我怀疑的是事实table
情况 1:我应该只添加 'order_id(fk)'
和 'total_order_cost(as measure)'
==>在这种情况下 "product_set" 的测量实际上不会存在 table.
或者大小写2:i应该加上'order_id(fk)','product_set_id(fk)' and 'cost_per_quantity(measure), quantity(measure), total_order_cost(measure)'
==>在这种情况下,相同的 'order_id' and 'total_order_cost'
还有其他一些 table 像 "customer" 等,但我对上面提到的有疑问。
提前致谢!
总是提出的一个建议是在表上创建一个代理键。我的事实 sales 是这样的,它有代理键,允许我在那里有订单数据,每个订单都由代理键标识(我并没有真正使用 - 但它不是问题)。这样你就可以按照案例 2 进行操作。
这是否回答了问题?