Describe the concept of slowly changing dimensions (SCDs) and explain how you would implement Type 2 SCD in a target data warehouse.
Use the provided source and target tables to apply the Type 2 changes, preserving historical versions and marking the latest version as current.
customer_sk, customer_id, customer_name, segment, region, valid_from, valid_to, and is_current.customer_id and then valid_from ascending.| Column | Type | Description |
|---|---|---|
| customer_skPK | BIGINT | Warehouse surrogate key for a customer version |
| customer_id | INT | Source-system customer identifier |
| customer_name | VARCHAR(150) | Customer name for this dimension version |
| segment | VARCHAR(80) | Customer business segment |
| region | VARCHAR(80) | Customer geographic region |
| valid_from | TIMESTAMP | Timestamp when this version became effective |
| valid_to | TIMESTAMP | Timestamp when this version stopped being effective |
| is_current | BOOLEAN | Whether this is the current version |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Source-system customer identifier |
| customer_name | VARCHAR(150) | Latest source customer name |
| segment | VARCHAR(80) | Latest source customer segment |
| region | VARCHAR(80) | Latest source customer region |
| effective_at | TIMESTAMP | Effective timestamp for the source version |