mysql临时表是session级的,在连接mysql期间存在,断开连接自动删除临时表。
创建临时表:
create temporary table table1(id int not null auto_increment,name varchar(10),age int(11),money decimal(10,2),primary key(id))ENGINE=InnoDB DEFAULT CHARSET=utf8
注:ENGINE为设置数据库引擎,数据库引擎主要有InnoDB、MyISAM。
清空临时表数据:
truncate table table1
手动删除临时表
drop table table1
其他操作同普通表