使用 Dim tables 在 Fact table 上创建数据仓库
Data warehouse creation on Fact table with Dim tables
我正在尝试理解暗淡的 table 与事实 table 的关联逻辑。
我目前有一个事实 table 没有数据,并且有两个 Dim Table 有数据。
昏暗Table 1:郊区
昏暗 Table 2:餐厅
因为 Dim table 有不同的行数。如何使 Fact table link 与显示正确 order/results 的郊区和餐馆的 Dim table 相匹配?
- 事实 table 持有事实或数字。
- 维度 table 是关于事实的维度或方面。
The data stored in fact, determines the granularity of the facts.
The granularity of facts decide the granularity of dimension tables.
E.g., 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.
1 份$20 美元的披萨在 Bellevue 郊区的一家餐厅 Pizza Garden 售出,将存储如下:
昏暗郊区:
+-------------+------------+
| DimsuburbId | Suburbname |
+-------------+------------+
| 1 | Bellevue |
+-------------+------------+
昏暗餐厅:
+-----------------+----------------+
| DimRestaurantId | RestaurantName |
+-----------------+----------------+
| 1 | Pizza Garden |
+-----------------+----------------+
DimItem;
+-----------+----------+
| DimItemId | ItemName |
+-----------+----------+
| 1 | Pizza |
+-----------+----------+
事实餐厅销售:
+-----------------------+--------------+-----------------+---------+-------------+----------------+
| FactRestaurantSalesId | DimSuburbId | DimRestaurantId | DimItem | DollarSales | QuantitySales |
+-----------------------+--------------+-----------------+---------+-------------+----------------+
| 1 | 1 | 1 | 1 | 20 | 1 |
+-----------------------+--------------+-----------------+---------+-------------+----------------+
我正在尝试理解暗淡的 table 与事实 table 的关联逻辑。
我目前有一个事实 table 没有数据,并且有两个 Dim Table 有数据。
昏暗Table 1:郊区
昏暗 Table 2:餐厅
因为 Dim table 有不同的行数。如何使 Fact table link 与显示正确 order/results 的郊区和餐馆的 Dim table 相匹配?
- 事实 table 持有事实或数字。
- 维度 table 是关于事实的维度或方面。
The data stored in fact, determines the granularity of the facts. The granularity of facts decide the granularity of dimension tables.
E.g., 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.
1 份$20 美元的披萨在 Bellevue 郊区的一家餐厅 Pizza Garden 售出,将存储如下:
昏暗郊区:
+-------------+------------+
| DimsuburbId | Suburbname |
+-------------+------------+
| 1 | Bellevue |
+-------------+------------+
昏暗餐厅:
+-----------------+----------------+
| DimRestaurantId | RestaurantName |
+-----------------+----------------+
| 1 | Pizza Garden |
+-----------------+----------------+
DimItem;
+-----------+----------+
| DimItemId | ItemName |
+-----------+----------+
| 1 | Pizza |
+-----------+----------+
事实餐厅销售:
+-----------------------+--------------+-----------------+---------+-------------+----------------+
| FactRestaurantSalesId | DimSuburbId | DimRestaurantId | DimItem | DollarSales | QuantitySales |
+-----------------------+--------------+-----------------+---------+-------------+----------------+
| 1 | 1 | 1 | 1 | 20 | 1 |
+-----------------------+--------------+-----------------+---------+-------------+----------------+