Skip to content
SQLSimplified
Data EngineerQuestion 41 of 55

SCD Type 2 (Historical Tracking)

Problem

To calculate historical commission sales, you need to know what country a salesperson lived in at the exact second they placed an order. You decide to track changes over time by creating new rows with validity date ranges. Write a query that outputs behavior with the value: "SCD Type 2 tracks historical changes by adding a new row for each change, using start_date, end_date, and active flags."

Database Schema

This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.

Try It

Loading playground environment...

Hint

Solution