Year 2011 was a year of learning and opportunity for me. My recent book, SQL Server Interview Questions and Answers, has received such overwhelming love and support from all of you. While writing the book, I had two simple goals: (1) Master the Basics and (2) Ignite Learning. There was a constant request from the Community to take the learning of these books to the next level. Here is an article which discusses the Author’s Perspective.
Beyond Relational has come up with a very interesting concept – they have converted a few of the questions from my book into the SQL Quiz. The quiz is indeed focused on my two goals. In addition, it’s going to put the learning of the book to a higher stage. Looking at this novel concept, Vinod Kumar (Co-author) and I have decided to help every participant and reader by giving a few hints and suggestions to solve the quiz.
In any performance-testing discussion for a huge, significant development, one of the common requirements is to send multiple values to SQL Server in a single shot. So to help achieve this this requirement, SQL Server introduced the MERGE statement. What is the construct of a MERGE statement? What are the restrictions of using the MERGE?
A MERGE statement has great benefits as ETL requirements. Read for more details. As you use them in relational engine, can you tell how you can get details of how many INSERTS, UPDATES and DELETES have happened as part of the database?
What is UPSERT? It is commonly used word for INSERT and UPDATE. How about adding DELETE to the UPSERT as well – what will you call? I will call it MERGE. When I came across MERGE I was very happy as it was not only INSERT, UPDATE and DELETE but if used correctly there were many advantages associated with this operation. Initially, it was very hard into use MERGE statement as I was so used to writing INSERT, UPDATE and DELETE. As I kept myself open to this new procedure; I learned that this can be very helpful. To master any feature, solution or tool, one needs to learn about the limitations of MERGE . Today’s question is based on the main questions above: “What is MERGE and what are the restrictions of the MERGE statement?”
SQL Server Interview Questions and Answers ISBN: 1466405643 Page#112
Merge Operations – Insert, Update, Delete in Single Execution
Introduction to Merge Statement – One Statement for INSERT, UPDATE, DELETE
Explanation SQL SERVER Merge Join
Note: SQL Quiz, winners and prizes are administrated by Beyond Relational. The goal of this blog post is to provide additional learning pointers only.
Reference: Pinal Dave (http://blog.sqlauthority.com)