mysql (create temporary table table_name )临时表创建


一般在数据量比较大的查询中,用in()等查询条件,会严重影响查询效率。

这时可以用  create temporary table table_name select id,name from table    创建临时表

使用临时表时注意事项:

1.自己所用的数据库账号要有建立临时表的权限;
2.在同一条sql中,不能关联2次相同的临时表,不然,就会报如下错误;

RROR 1137: Can’t reopen table: ‘temp_table’

3.临时表在建立连接时可见,关闭时会清除空间,删除临时表;
4.show tables 不会列出临时表;


原文链接:https://blog.csdn.net/u010265663/article/details/50210867


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM