1.sqlserver中,使用:
select * into tab_new from tab_old
SELECT * into anzhiresult from (select * from factdownloads_new where storename='anzhi') b
复制表结构句型,跨数据库
--复制结构+数据
select * into 数据库名.dbo.新表名 from 数据库名.dbo.原表名
--只复制结构select * into 数据库名.dbo.新表名 from 数据库名.dbo.原表名 where 1=0--复制到临时表
select * into #temptablename from 数据库名.dbo.原表名 where 1=0
2.oracle建表方式为:
create table tab_new like tab_old (使用旧表创建新表)
create table tab_new as select col1,col2… from tab_old definition only
3.MYSQL不支持上面语法
方法1:
Select * Into new_table_name from old_table_name;
替代方法:
Create table new_table_name (Select * from old_table_name);
CREATE table anzhi_result
(SELECT * from factdownloads_new where storename='anzhi')
方法2:
1.先备份表结构和数据
#导出命令 -u用户名 -p密