网络编程
位置:首页>> 网络编程>> 数据库>> SQL Server和MySql中创建临时表

SQL Server和MySql中创建临时表

作者:Ystar灬龙子 来源:CSSLong 发布时间:2008-06-19 13:31:00 

标签:sql,sql,server,mysql,表

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 临时表名

关于MySql创建临时表,在Mysql命令端可以成功创建临时表,但是我在PHPMyadmin中一直创建不成功,很是郁闷....

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com