本节内容:
select into 与 insert into的例子
1,SQL Server:
复制代码 代码示例:
select * into Table2 from Table1;
Insert into Table2(field1,field2,...) select value1,value2,... from Table1;
2,Oracle:
复制代码 代码示例:
create table Table2 as select * from Table1;
insert into Table2 values select * from Table1;
3,mysql/ target=_blank class=infotextkey>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;
-- by www.jb200.com
--将备份数据还原至原表
insert into uc_dict (select * from uc_dict_bak);