MySQL内存表和临时表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL内存表和临时表相关的知识,希望对你有一定的参考价值。
#mysql内存表和临时表 DROP TABLE IF EXISTS tbl; CREATE TABLE tbl ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR (50) NOT NULL, author VARCHAR (50) NOT NULL, PRIMARY KEY (id) ) ENGINE = INNODB DEFAULT CHARSET = utf8; INSERT INTO tbl(title, author) VALUES(‘Learn MySQL‘, ‘John Poul‘),(‘Learn Java‘, ‘Adbul S‘); #内存表 DROP TABLE IF EXISTS mmr; CREATE TEMPORARY TABLE mmr ( #title TEXT NOT NULL#内存表不支持BLOB/TEXT列 author VARCHAR (50) NOT NULL ) ENGINE = MEMORY DEFAULT CHARSET = utf8; INSERT INTO mmr SELECT author FROM tbl; SELECT author FROM mmr; #临时表 DROP TABLE IF EXISTS tmp; CREATE TEMPORARY TABLE tmp ( title TEXT NOT NULL, author VARCHAR (50) NOT NULL ) ENGINE = MYISAM DEFAULT CHARSET = utf8; INSERT INTO tmp (title, author) SELECT title, author FROM tbl; SELECT title, author FROM tmp;
以上是关于MySQL内存表和临时表的主要内容,如果未能解决你的问题,请参考以下文章