Free views, likes and subscribers at YouTube. Now!
Get Free YouTube Subscribers, Views and Likes

SCD Type 1 and Type 2 using SQL | Implementation of Slowly Changing Dimensions

Follow
Ankit Bansal

In this video we will learn how to implement scd type 1 and type 2 using SQL. This will help you build logics using update and insert statement.
script:
CREATE TABLE product_stg(
Product_id INT,
Product_Name VARCHAR(50),
Price DECIMAL(9,2)
);

CREATE TABLE product_dim(
Product_id INT primary key,
Product_Name VARCHAR(50),
Price DECIMAL(9,2),
last_update date
);

create TABLE product_dim(
product_key int identity(1,1) primary key,
Product_id INT,
Product_Name VARCHAR(50),
Price DECIMAL(9,2),
start_date date,
end_date date
);

Zero to hero(Advance) SQL Aggregation:
   • All About SQL Aggregations | SQL Adva...  

Most Asked Join Based Interview Question:
   • Most Asked SQL JOIN based Interview Q...  

Solving 4 Trick SQL problems:
   • Solving 4 Tricky SQL Problems  

Data Analyst Spotify Case Study:
   • Data Analyst Spotify Case Study | SQL...  

Top 10 SQL interview Questions:
   • Top 10 SQL interview Questions and An...  

Interview Question based on FULL OUTER JOIN:
   • SQL Interview Question Based on Full ...  

Playlist to master SQL :
   • Complex SQL Questions for Interview P...  

Rank, Dense_Rank and Row_Number:
   • RANK, DENSE_RANK, ROW_NUMBER SQL Anal...  

#sql #dataengineer

posted by skuffanmy