0% found this document useful (0 votes)
4 views

L21 SQL-merge

Uploaded by

shivbeej33
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

L21 SQL-merge

Uploaded by

shivbeej33
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

SQL Tutorial

SQL

Copyright IntelliPaat. All rights reserved


Agenda
Employee

1 Merge in SQL

Department

Copyright IntelliPaat. All rights reserved


Merge

MERGE is the combination of INSERT, DELETE, and UPDATE statements.

Insert Update Delete

Copyright IntelliPaat. All rights reserved


Merge

Source Table Target Table

Copyright IntelliPaat. All rights reserved


Merge

Source Table Target Table

Merge

Copyright IntelliPaat. All rights reserved


Merge

Implementing
the Merge MERGE [Target] AS T
statement! USING [Source] AS S
ON [Join Condition]
WHEN MATCHED
THEN [Update Statement]
WHEN NOT MATCHED BY TARGET
THEN [Insert Statement]
WHEN NOT MATCHED BY SOURCE
THEN [Delete Statement];

Copyright IntelliPaat. All rights reserved


Merge

Source Table Target Table

Employee_Source Employee_Target

Copyright IntelliPaat. All rights reserved


Thank You

Copyright IntelliPaat. All rights reserved

You might also like