Databricks Data Engineer Professional Question 193
Select 3You are tasked with implementing a Slowly Changing Dimension (SCD) table to track changes in customer data for an e-commerce platform. The requirements are as follows:
- The 'email' field should never change after it is initially set.
- The 'phone_number' field should always reflect the most recent value.
- The 'address' field should maintain a history of changes with start and end timestamps.
Which combination of SCD types would you choose to meet these requirements?
- A
SCD Type 0 for the 'email' field
- B
SCD Type 1 for the 'phone_number' field
- C
SCD Type 2 for the 'address' field
- D
SCD Type 1 for the 'email' field
- E
SCD Type 2 for the 'phone_number' field
Show answer and explanation
Correct answers: A, B, C
Explanation
To implement the requirements, 'email' should use SCD Type 0 because it must remain unchanged, 'phone_number' should use SCD Type 1 because it needs to store only the latest value, and 'address' should use SCD Type 2 to maintain a history of changes with timestamps. Each SCD type is chosen based on the specific behavior required for the field.
- A. Correct.
Correct. SCD Type 0 is used when a field's value should never change after it is initially set, which matches the requirement for the 'email' field.
- B. Correct.
Correct. SCD Type 1 overwrites the existing value with the most recent value, aligning with the requirement for the 'phone_number' field to always reflect the latest data.
- C. Correct.
Correct. SCD Type 2 maintains a history of changes with additional fields for tracking, such as start and end timestamps, which suits the requirement for the 'address' field.
- D. Incorrect.
Incorrect. SCD Type 1 would overwrite the 'email' field, violating the requirement that it should never change.
- E. Incorrect.
Incorrect. SCD Type 2 would maintain a history of changes for the 'phone_number' field, which is unnecessary since it only needs to store the most recent value.