Get YouTube subscribers that watch and like your videos
Get Free YouTube Subscribers, Views and Likes

SQL Merge Statement Tutorial A-Z | How to use Merge in SQL step by step

Follow
Ankit Bansal

In this video we will understand the SQL merge statement. Using merge statement we can insert , update and delete data in a single statement.

script:
CREATE TABLE SourceProducts(
ProductID INT,
ProductName VARCHAR(50),
Price DECIMAL(9,2)
);
CREATE TABLE TargetProducts(
ProductID INT,
ProductName VARCHAR(50),
Price DECIMAL(9,2)
);


delete from SourceProducts;
INSERT INTO SourceProducts VALUES(1,'Table',90),(3,'Chair',70)

delete from TargetProducts;
INSERT INTO TargetProducts VALUES(1,'Table',100),(2,'Desk',180)


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 #merge

posted by skuffanmy