MySQL–BeginningTemporaryTablesinMySQL_MySQL
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了MySQL–BeginningTemporaryTablesinMySQL_MySQL,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1716字,纯文字阅读大概需要3分钟。
内容图文
![MySQL–BeginningTemporaryTablesinMySQL_MySQL](/upload/InfoBanner/zyjiaocheng/578/ea5db1d9fff446ec8fe77af07dfccb3b.jpg)
Let us create the temporary table named Temp
CREATE TEMPORARY TABLE TEMP
(id INT);
Now you can find out the column names using DESC command
DESC TEMP;
The above returns the following result
This table can be accessed only for the current connection and it can be used like a permanent table and automatically dropped when the connection is closed. However, you can not find temporary tables using INFORMATION_SCHEMA. TABLES system view. It will only list out the permanent tables.
MySQL usually stores the data of temporary tables in memory and processed by Memory Storage engine. But if the data size is too large MySQL automatically converts this to the on – disk table and use MyISAM engine.
You can also create a permanent table with the same name of a temporary table in the same connection. However the structure of permanent table is visible only if the temporary table with the same name is dropped.
Let us create a permanent table with the same name Temp as below
CREATE TABLE TEMP
(id INT,
names VARCHAR(100));
Now running the following command stills gives you the structure of the temporary table temp created earlier.
DESC TEMP;
You can drop the temporary table using DROP TEMPORARY TABLE command;
DROP TEMPORARY TABLE TEMP;
After you executed the temporary table, run the following command
DESC TEMP;
Now you will see the structure of the permanent table named temp
In summary– If there is a Temporary Table in MySQL it gets first priority over the permanent table in the session.
Reference: Pinal Dave (http://blog.sqlauthority.com)
内容总结
以上是互联网集市为您收集整理的MySQL–BeginningTemporaryTablesinMySQL_MySQL全部内容,希望文章能够帮你解决MySQL–BeginningTemporaryTablesinMySQL_MySQL所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。