SQL Tricky Update Query Interview Questions with Answers

You have following table "TestUpdate".










Q 1.) What would be the output of following query?
UPDATE Testupdate SET ID = ID + (SELECT MAX(ID) FROM Testupdate)
SELECT * FROM Testupdate

Ans:













Q 2.) What would be the output of following query? based on blow table


UPDATE Testupdate SET ID = ID + (SELECT MAX(ID) FROM Testupdate)
GO 2
SELECT * FROM Testupdate

Ans: (Note:- it will run two time because we have used "Go 2")














Q 3.) What would be the output of following query?
UPDATE Testupdate SET ID = ID + MAX(ID)
Ans: 

Comments

Contact Form

Send