Skip to main content
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

Pro

Unlock 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

Pro
Unlock with Pro

Visual explainer· animated, step by step

Pro
Unlock with Pro

Common mistakes· 4

Pro
Locked

Best practices· 4

Pro
Locked

Likely follow-ups· 4 questions

Pro
Unlock with Pro

+ 24 more Databricks questions in Pro, each with the full answer.

Discussion