I have an OLTP database having some tables. I want to build a DW star schema from this database. I extracted three tables--Customer, Store, SalesPerson--from source to staging area and put a surrogate key as primary key in all three tables. These three tables also have respective primary keys (business keys) from OLTP but don't have relationship with each other through foreign keys. After that I populated dimension tables from staging area. Now i want to populate fact table from these dimension tables. The strategy is that I have to join dimension tables based on their business keys and put surrogate key of each dimension to fact table along with some fact values. But the problem is that the dimensions don't have business keys on which I could join them. And if I join dimensions on surrogate keys then how to keep track to the OLTP in case of SCD type 2? enter image description here
The image is attached. This is the source OLTP. I want Customers, Products, Offices and Employees as dimension tables and "Price each","quantity ordered" as facts. Can you please how can I build a data warehouse from these mentioned tables and fact. Thank you
Say your source OLTP system has a sale record that looks like this:
In your data warehouse you have 3 dimension tables:
Customer_dim:
Product_dim:
Date_dim:
From your source record, you take each relevant column, join it to the BK in the relevant dimension table to look up the corresponding SK and then write the record to your fact table. So your fact table would look like this: