Tech Point Fundamentals

Friday, July 2, 2021

SQL Temporary Table Interview Questions and Answers

SQL Temp Table Interview Questions and Answers

SQL--Temp-Table-Interview-Questions


Below are the most common interview questions based on the Temp Table:




Q01. What is Temp Table or Temporary Table in SQL? 

 A. Is duplicate Temp Table names allowed?

 B. Can a Temp Table be used for SELECT INTO or INSERT EXEC statement? 

 C. What are the different ways to create Temp Table in SQL?

Q02. What is Local Temporary Table in SQL?

Q03. What is Global Temporary Table in SQL?

Q04. What is the difference between Local and Global Temporary Table in SQL?

Q05. What is the difference between Temp Table and Derived Table in SQL?

Q06. What is the difference between Temp Table and Common Table Expression in SQL?

Q07. What is the difference between Temp Table and Table Variable in SQL?

Q08. What is the difference between Temp Table and Table-Valued Parameter in SQL?

Q09. What is the storage location for the Temp Tables?



Q10. How many Temp Tables can be created with the same name?

Q11. How many users or who can access the Temp Tables?

Q12. Can you create an Index and Constraints on the Temp Table?

Q13. Which collation will be used in the case of Temp Table, the database on which it is executing or temp DB? What is a collation conflict error and how you can resolve it?

Q14. What is a Contained Database? How it affects the Temp Table in SQL?

Q15. Can you apply Foreign Key constraints to a temporary table?

Q16. Can you use the Temp Table before declaring it? 

Q17. Can you use Temp Table in the User-Defined Function?

Q18. If you perform an Insert, Update, or delete operation on Temp Table, does it also affect the underlying base table?

Q19. Is it mandatory to drop the Temp Tables after use? How can you drop the temp table in a stored procedure that returns data from the temp table itself?



Q20. Is there any transaction log created for the operations performed on the Temp Table?

Q21. Can you use explicit transactions on Temp Table? Does Temp Table hold lock? Does temp table create Magic Tables?

Q22. Can you TRUNCATE the temp table?

Q23. Can a trigger access the temp tables created in the connection?

Q24. Can you create a new temp table with the same name after dropping the temp table within a stored procedure?

Q25. Can you access a temp table created by a stored procedure in the same connection after executing the stored procedure?

Q26. Can nested stored procedure access the temp table created by the parent stored procedure?

Q27. Can you ALTER the temp table?

Q28. Can you reset the IDENTITY Column of the temp table? 

Q29. Can you insert the IDENTITY Column value in the temp table?



Q30. Can you partition a temp table?

Q31. Can you create a column with user-defined data types (UDDT) in the temp table?

Q32. Can you create a trigger on the temp table?

Q33. Can you create a temp table within the trigger?

Q34. How many concurrent users can access a stored procedure that uses a temp table?

Q35. Can you partition Temporary Tables?

Q36. Can you pass a temp table to the stored procedure as a parameter?

Q37. Can you create a view on the temp table?

Q38. Can you use a Temp Table in Dynamic Query?

Q39. Can you use a temp table created within the dynamic SQL, from outside the dynamic SQL?





Live Demo





Watch our related videos here




Recommended Articles


Derived Table Interview Questions
Common Table Expression Interview Questions
Partial Interface Methods in C# 8
Interface Member Modifiers in C# 8
Multiple Interface Inheritance in C# 8
Interface Virtual Method in C# 8
Interface Access Modifiers in C# 8





Thanks for visiting this page. Please follow us on Twitter, Facebook, LinkedIn, Telegram,
WhatsApp, Youtube, and Pinterest for regular updates.

No comments:

Post a Comment

Please do not enter any HTML. JavaScript or spam link in the comment box.