In the previous post, I had shown you, How to implement SCD Type 1 . Today, I am going to implement SCD Type 2.
Unlike SCD Type1, in SCD Type 2, we store all the changes/previous values of the dimension attribute. To implement this, we need to have at least two additional columns in the dimension table i.e. start_date and end_date. We can keep the value of end date as NULL for currently active record.
Unlike SCD Type1, in SCD Type 2, we store all the changes/previous values of the dimension attribute. To implement this, we need to have at least two additional columns in the dimension table i.e. start_date and end_date. We can keep the value of end date as NULL for currently active record.
Summary of Slowly Changing Dimension Type 2
1. All the historical changes for the dimension attribute is stored in Dimension Table.
2. New columns (start date and end date) need to be created.
3. New record will be inserted in the Dimension table for every change in the dimension attribute. Hence, Primary Key remains the same but Surrogate Key changes.
You may also like to read..
No comments:
Post a Comment