本文介绍了怎么解决呢?使用桥接表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个星型模式并遇到此问题.我有一个二维表-一个产品(键=产品ID)和一个客户(键=客户ID).在另一个表中有三个字段-业务单位,产品ID和客户ID.在此表中,一个产品ID指的是许多业务单位和许多客户ID.我的问题是,我是否需要将第三张桌子作为Product Dim和Customer Dim之间的桥梁?还是应该有更好的解决方法?

I am designing a star schema and come across this problem. I have two dimension table - a Product (Key = Product Id) and a Customer (Key = Customer Id). In another table there are three fields - Business Unit, Product Id and Customer Id.In this table one Product id refers to many Business Units and many Customer Ids. My question is do i need to place the third table as a bridge table between Product Dim and Customer Dim? Or what should be a better way to solve this?

产品编号产品名称........ etc

Product IDProduct Name........etc

Customer_Id顾客姓名客户类型.....等

Customer_IdCustomer NameCustomer Type.....etc

业务部门产品编号客户ID.....等

Business UnitProduct IDCustomer ID.....etc

现在,我创建了第三个表作为Bridge表,并与Product and Customer Dim联接在一起.第三个表将Product_id和Customer_id作为FK,并将业务单位作为属性.这是正确的方法吗?

Right now i created the third table as Bridge table and joined with Product and Customer Dim. The third table will have Product_id and Customer_id as FKs and Business Unit as the attribute.Is this the right approach?

谢谢,阿伦

推荐答案

是的,这就是所谓的多对多关系.一个产品可以连接到许多公司,一个公司可以连接到许多产品.

Yes, this is what's called a many-to-many relation. A product can be connected to many companies, and a company can be connection to many products.

这篇关于怎么解决呢?使用桥接表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 02:47