Advancedhow it works Verified ~12 min
How do you implement SCD Type 2 in Delta Lake with a single MERGE?
Source: Databricks: what is Delta Lake
Quick answerFree
Keep is_current, start_date and end_date columns. Build a staged source that contains each changed row twice: once with the real key (to close the current row) and once with a NULL merge key (which never matches, so it inserts the new version). One MERGE does both atomically.
Detailed answer· ~280 words
ProUnlock the full answer with Pro
Get a ~280-word model answer, 5 key points, a visual explainer, 4 common mistakes and 4 follow-ups, plus 24 more Databricks questions.
Key points· 5 points
ProUnlock with Pro
Visual explainer· animated, step by step
ProUnlock with Pro
Common mistakes· 4
ProLocked
Best practices· 4
ProLocked
Likely follow-ups· 4 questions
ProUnlock with Pro
+ 24 more Databricks questions in Pro, each with the full answer.