Interview practice question
SCD Type 2 in Snowflake
Data Engineering · Snowflake · Intermediate
You need to keep full history of customer address changes in a dimension table. How would you implement SCD Type 2 in Snowflake?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Add columns like effective_from, effective_to and is_current.
- Detect changes using a hash of tracked attributes.
- Close the old row (set effective_to, is_current = false) and insert a new current row.
- Do it in one MERGE using a union trick, or two statements in a transaction.
- dbt snapshots can do this automatically.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.