Bird
0
0

Given this simplified dbt SQL snippet for SCD Type 2:

medium📝 Predict Output Q4 of 15
dbt - Advanced Patterns
Given this simplified dbt SQL snippet for SCD Type 2:
SELECT id, name, effective_date, end_date FROM dim_customer WHERE end_date IS NULL;

What does this query return?
ARecords with no effective_date
BAll historical records including expired
COnly the current active records
DRecords that have been deleted
Step-by-Step Solution
Solution:
  1. Step 1: Analyze WHERE clause and interpret result

    The condition 'end_date IS NULL' filters for records without an end date, meaning active versions. These are the current active records, excluding expired history.
  2. Final Answer:

    Only the current active records -> Option C
  3. Quick Check:

    WHERE end_date IS NULL = active records [OK]
Quick Trick: end_date NULL means record is active [OK]
Common Mistakes:
MISTAKES
  • Thinking it returns all history
  • Confusing effective_date with end_date
  • Assuming deleted records appear

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes