I write numerous queries and admittedly few of them involve the use of MERGE, but this article posted on mssqltips.com titled “Using MERGE in SQL Server to insert, update and delete at the same time” by Arshad Ali (2019-04-09) has given me cause to change.
The article presents a very simple example of how MERGE can be used to insert, update, and delete at the same time. This is a clever and much easier to manage approach to performing these tasks in the traditional manner.
The article is a short read and worthy of your investment of time. The article also refers to Oracle’s UPSERT and why MERGE may be a better option.