首页 > 代码库 > MySQL内存表和临时表
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内存表和临时表
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。