如何从关系源填充 Dim_tbls?
给出了这些示例表:
tbl_sales: id_sales, fk_id_customer, fk_id_product, country, timestamp
tbl_customer: id_customer, name, adress, zip, city
tbl_product: id_product, price, product
我的目标是将这些属性放入启动模式中。我遇到的问题是加载维度表背后的逻辑。我的意思是,我会将哪些数据加载到 Dim_Product 中?tbl_product 中的所有产品?但是我怎么知道特定产品完成了多少销售呢?
我想做的分析是:
How many people bought product x.
How many sales are made from city x.
How many sales were made between Time x and y.
示例数据:
tbl_sales: id_sales | fk_id_customer | fk_id_product | country | timestamp
1 | 2 | 1 | UK | 19.11.2013 10:23:22
2 | 1 | 2 | FR | 20.11.2013 06:04:22
tbl_customer: id_customer | name | adress | zip | city
1 | Frank|Street X| 211 | London
2 | Steve|Street Y| 431 | Paris
tbl_customer: id_product| Price | product
1 | 100,00| Hammer
2 | 50,00| Saw