现在的位置: 首页 > 综合 > 正文

MySql 局部-全局临时表 temporary表是session级的,创建后用show tables也看不到它。

2012年11月12日 ⁄ 综合 ⁄ 共 349字 ⁄ 字号 评论关闭

SQL Server创建临时表:
创建临时表
方法一:
create table #临时表名(字段1 约束条件,字段2 约束条件,...)
create table ##临时表名(字段1 约束条件,字段2 约束条件,...)
方法二:
select * into #临时表名 from 你的表;
select * into ##临时表名 from 你的表;
注:以上的#代表局部临时表,##代表全局临时表

查询临时表
select * from #临时表名;
select * from ##临时表名;

删除临时表
drop table #临时表名;
drop table ##临时表名;

Mysql创建临时表
创建临时表
create temporary table 临时表名(字段1 约束条件,字段2 约束条件,...)

查询临时表
select * from 临时表名

删除临时表
drop table 临时表名

抱歉!评论已关闭.