OK. I saw two companies fields. One is on the deal table, the other is on the store table. Are they the same? Usually a deal has a buyer and a seller. Could they mean buyer company and seller company?
On Thu, Sep 21, 2017 at 12:05 PM, 崔苗 <cuim...@danale.com> wrote: > 如果一个store_id只属于一个company_id,你可以断开t_deal_history与t_company的连接,通过store_ > id可以间接对应到company_id和company_name,这样模型比较简单,也不会出现错误组合。 > > ------------------------------------------------------------------ > 发件人:li...@fcyun.com <li...@fcyun.com> > 发送时间:2017年9月21日(星期四) 11:54 > 收件人:user <user@kylin.apache.org> > 主 题:how to avoid the combination of this situation: " Apple company have a > Nike store"? > > hi, Thanks for your reading this first! > > > 1.here's my tables: > > t_deal_history is the fact table that recording every bill of a store. > t_store is the lookup table > t_company is the lookup table, one company can have many stores in > different place. > > > > sample data for the tables: > t_compay: > company_id company_name > 1 NIKE > 2 Apple > > t_store: > > store_id store_name company_id > 1 Nike Flagship store 1 > 2 Nike Shoes store 1 > 3 Apple NewYork 2 > 4 Apple Tokyo 2 > > > t_deal_history: > > deal_history_id store_id company_id bill_money > 1 1 1 100.00 > 2 2 1 100.00 > 3 3 2 100.00 > 4 4 2 100.00 > > kylin model design: > > > Did this can occur a cubeid which " Apple company have a Nike store"? > how to avoid the combination of this situation? > Or, change t_deal_history don't join with t_store instead of join with > t_company directly, is it possible? > > > What's the right relationship between these three tables? any ideas? > > > > Thanks a lot. > > ------------------------------ > li...@fcyun.com > >