[英]Data warehouse creation on Fact table with Dim tables
I'm trying to understand the logic on how dim tables are connected with Fact tables.我试图了解暗表如何与事实表连接的逻辑。
I currently have a fact table that has no data and have two Dim Tables that have data.我目前有一个没有数据的事实表,并且有两个有数据的 Dim 表。
Dim Table 1: Suburbs暗表 1:郊区
Dim Table 2: Restaurants暗表2:餐厅
As Dim table have different number of rows.由于 Dim 表有不同的行数。 How do I make the Fact table link the Dim table with the suburbs and Restaurants that shows the correct order/results?
如何使 Fact 表将 Dim 表与显示正确订单/结果的郊区和餐厅联系起来?
The data stored in fact, determines the granularity of the facts.
事实上存储的数据决定了事实的粒度。 The granularity of facts decide the granularity of dimension tables.
事实的粒度决定了维表的粒度。
Eg, Suburbs is a dimension: Holds the suburb details
例如,郊区是一个维度:保存郊区详细信息
Restaurants is a dimension: Holds the Restaurant details餐厅是一个维度:包含餐厅详细信息
FactRestaurantSales is a Fact: Holds the sales at Restaurant granularity level.FactRestaurantSales 是一个事实:以餐厅粒度级别保存销售额。
1 Pizza of $20 dollars were sold in a restaurant Pizza Garden in suburb Bellevue, will be stored as below: 1 块 20 美元的比萨饼在贝尔维尤郊区的比萨花园餐厅出售,存储如下:
DimSuburb:昏暗郊区:
+-------------+------------+
| DimsuburbId | Suburbname |
+-------------+------------+
| 1 | Bellevue |
+-------------+------------+
DimRestaurant:昏暗餐厅:
+-----------------+----------------+
| DimRestaurantId | RestaurantName |
+-----------------+----------------+
| 1 | Pizza Garden |
+-----------------+----------------+
DimItem;暗项;
+-----------+----------+
| DimItemId | ItemName |
+-----------+----------+
| 1 | Pizza |
+-----------+----------+
FactRestaurantSales: FactRestaurant销售:
+-----------------------+--------------+-----------------+---------+-------------+----------------+
| FactRestaurantSalesId | DimSuburbId | DimRestaurantId | DimItem | DollarSales | QuantitySales |
+-----------------------+--------------+-----------------+---------+-------------+----------------+
| 1 | 1 | 1 | 1 | 20 | 1 |
+-----------------------+--------------+-----------------+---------+-------------+----------------+
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.