What are the use cases for temporary tables in SQL database systems?

删除回忆录丶 提交于 2019-12-10 15:30:12

问题


what are the main purposes for which temporary tables are used? I want to know the practical and commercial uses of temporary tables in actual softwares working in small and large scale companies.


回答1:


In my experience, temporary tables are often used to store intermediate calculations in a complex series of CREATE or UPDATE queries that produce some sort of analysis result. An example might be the creation of summary tables for an OLAP database.

Temporary tables are also sometimes used to increase performance, in certain situations.




回答2:


I tend to prefer using CTEs (common table expressions) to temporary tables. There is a good discussion in answer to a similar question.



来源:https://stackoverflow.com/questions/4976585/what-are-the-use-cases-for-temporary-tables-in-sql-database-systems

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!