У нас вы можете посмотреть бесплатно Implement SCD Type 2 in SQL | Track Historical Data Changes Step by Step или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In this video, I’ll show you how to implement a Slowly Changing Dimension Type 2 (SCD Type 2) using SQL — step by step. We’ll use a fun and realistic example: tracking football players like Messi, Ronaldo, and Neymar as they change teams, while keeping their full history in our data warehouse ⚽📊 You’ll learn how to: ✅ Detect data changes between staging and dimension tables ✅ Update old records to close historical versions ✅ Insert new records for the latest data ✅ Preserve historical data with start and end dates 🔥 What’s covered: What is SCD Type 2 in data warehousing SQL logic for change detection (CTE, joins, updates, inserts) Real-world example using player transfers Step-by-step explanation of every query 🧱 Example Tables: `stg_team_roster` → Staging data (latest snapshot) `dim_team_roster` → Dimension table with history tracking DROP TABLE IF EXISTS stg_team_roster; CREATE TABLE stg_team_roster ( player_id INT, player_name VARCHAR(100), team_name VARCHAR(100), position VARCHAR(50), country VARCHAR(50), load_date DATE DEFAULT CURRENT_DATE ); INSERT INTO stg_team_roster (player_id, player_name, team_name, position, country, load_date) VALUES (10, 'Lionel Messi', 'Inter Miami', 'Forward', 'Argentina', '2025-10-01'), (7, 'Cristiano Ronaldo', 'Al Nassr', 'Forward', 'Portugal', '2025-10-01'), (11, 'Neymar Jr', 'Al Hilal', 'Forward', 'Brazil', '2025-10-01'), (19, 'Lamine Yamal', 'Barcelona', 'Forward', 'Spain', '2025-10-01'), (9, 'Endrick', 'Real Madrid', 'Forward', 'Brazil', '2025-10-01'); DROP TABLE IF EXISTS dim_team_roster; CREATE TABLE dim_team_roster ( roster_sk SERIAL, player_id INT NOT NULL, player_name VARCHAR(100), team_name VARCHAR(100), position VARCHAR(50), country VARCHAR(50), effective_date DATE NOT NULL, end_date DATE, is_current BOOLEAN DEFAULT TRUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); INSERT INTO dim_team_roster (player_id, player_name, team_name, position, country, effective_date, end_date, is_current) VALUES (10, 'Lionel Messi', 'PSG', 'Forward', 'Argentina', '2024-08-01', NULL, TRUE), (7, 'Cristiano Ronaldo', 'Manchester United', 'Forward', 'Portugal', '2024-08-01', NULL, TRUE), (11, 'Neymar Jr', 'PSG', 'Forward', 'Brazil', '2024-08-01', NULL, TRUE); 💡 Tools Used: PostgreSQL SQL (CTE, joins) 👨🏽💻 By the end, you’ll understand how to handle historical data changes — a key skill for any Data Engineer or Analyst. #SQL #DataEngineering #SCDType2 #PostgreSQL #DataWarehouse #ETL #DataAnalytics