Bird
0
0

You want to implement SCD Type 2 in dbt for a customer dimension. Which combination of columns should you include to correctly track history and identify current records?

hard🚀 Application Q15 of 15
dbt - Advanced Patterns
You want to implement SCD Type 2 in dbt for a customer dimension. Which combination of columns should you include to correctly track history and identify current records?
Acustomer_id, name, effective_from, effective_to, is_current
Bcustomer_id, name, last_updated, deleted_flag
Ccustomer_id, name, created_at, updated_at
Dcustomer_id, name, version_number, is_active
Step-by-Step Solution
Solution:
  1. Step 1: Identify key SCD Type 2 columns

    SCD Type 2 needs effective_from and effective_to timestamps plus a flag like is_current to mark active rows.
  2. Step 2: Compare options for completeness

    customer_id, name, effective_from, effective_to, is_current includes customer_id, name, effective_from, effective_to, and is_current, covering history and current record tracking.
  3. Final Answer:

    customer_id, name, effective_from, effective_to, is_current -> Option A
  4. Quick Check:

    Effective dates + is_current = customer_id, name, effective_from, effective_to, is_current [OK]
Quick Trick: Use effective dates and is_current flag for SCD Type 2 [OK]
Common Mistakes:
MISTAKES
  • Using only timestamps without current flag
  • Confusing deleted_flag with is_current
  • Using version_number without effective dates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes