SpinTheMic
Pro

Interview practice question

SCD Type 2 load in pure SQL

Data Engineering · SQL · Experienced

Without dbt, write the logic to maintain an SCD Type 2 customer dimension from a daily customer extract.

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Hash tracked attributes to detect changes.
  • Close changed current rows by setting valid_to and is_current = false.
  • Insert new versions for changed keys and brand-new keys.
  • Run both steps in one transaction.
  • Handle deletes if the business wants them tracked.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics