Top SQL Interview Questions and Answers

What is CTE?

Difference between Truncate and delete?

What is identity in SQL and how it works?

Difference between Temp table and CTE?

Difference between Temp table and Table Variable?

Difference between Function and Store Procedure in SQL?

How to delete duplicate rows?

How to insert or update using a View?

How would you find the second highest salary from the employee table?

What is ACID?

WITH NOWAIT vs WITH NOLOCK?

What does Merge does?

What is the use of OuterApply?

Does sequence of columns in index matters for performance ?

How many indexes can we create for a table?

You can create one clustered index, and up to 999 non clustered indexes per table.

Which of the following is an error function used within Catch block?

1. ERROR_STATE()

2. ERROR_STATUS()

3. ERROR_MSG()