← 🗄️ Data & SQL EngineeringNEXT IN DATA & SQL ENGINEERINGIncremental Models and MERGE/UPSERT→
Core
Slowly Changing Dimensions (SCD)
Slowly changing dimensions are the patterns for handling dimension attributes that change over time, such as a customer moving cities or a product changing category. Type 1 overwrites history, Type 2 retains versioned rows with effective dates and a current flag, and Type 3 retains a prior-value column. AI, ML, and GenAI interviews probe it because answering what something looked like at the time of an event requires deliberate history tracking, and most analysts only know how to overwrite.
a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
SQL & Data EngineeringImplement Slowly Changing Dimension Type 2 history tracking in a Delta lakehouse.→SQL & Data EngineeringWhat is a MERGE (upsert), and how do you use it for incremental loads and SCDs?→SQL & Data EngineeringGiven rows with start and end timestamps, merge all overlapping intervals per user in SQL.→SQL & Data EngineeringGroup a stream of user events into sessions in SQL (30-minute inactivity gap) using window functions.→SQL & Data EngineeringFind the top-N records per group and a running total per group in SQL.→SQL & Data EngineeringA SQL query is slow. How do you diagnose and optimize it?→
COMPANIES THAT ASSUME THIS
