我正在阅读 Ralph Kimball 关于数据仓库和维度建模的书,在第 6 章中,有关于维度角色扮演的部分。
Sometimes you discover other dates associated with each transaction, such as the requested ship date for the order. Each of the dates should be a foreign key in the fact table... However, you cannot simply join these two foreign keys to the same date dimension table. SQL would interpret this two-way simultaneous join as requiring both the dates to be identical, which isn’t very likely.
而且我不确定我是否理解最后两句话。如果事实表中的两个日期具有不同的值,这是否意味着您不能多次加入日期维度?为什么?
最佳答案
它表达得不是很好,但它只是说,如果您要从事实表中的不同 FK 多次加入日期维度,则需要为日期维度添加别名。
对于 2 个表不止一次连接在一起的任何 SQL 语句都是如此,它并不特定于维度建模。
关于database - 多次加入日期维度? - Kimball 关于数据仓库和维度建模的书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69595952/