select into 与 insert into

SQLServer:

select * into Table2 from Table1;

Insert into Table2(field1,field2,...) select value1,value2,... from Table1;

 

Oracle:

create table Table2 as select * from Table1;

insert into Table2 values select * from Table1;

 

 MySql:

 Create table new_table_name (Select * from old_table_name);

 Insert into Table2(field1,field2,...) select value1,value2,... from Table1;

-- 示例
--备份表数据
create table uc_dict_bak (select * from uc_dict);
--删除原表数据
delete from uc_dict;
--将备份数据还原至原表
insert into uc_dict (select * from uc_dict_bak);

 

猜你喜欢

转载自huangqiqing123.iteye.com/blog/1736302