SQL语句 如何快速地把一个表的数据复制到另外一个表里面


复制表结构

CREATE TABLE empty_table_name LIKE table_name;

根据table_name创建一个空表empty_table_name,empty_table_name没有任何数据。


SQL Server中,如果目标表存在:

1
insert into 目标表 select from 原表;

SQL Server中,,如果目标表不存在:

1
select into 目标表 from 原表;


Oracle中,如果目标表存在:

1
2
insert into 目标表 select from 原表;
commit;

Oracle中,如果目标表不存在:

1
create table 目标表 as select from 原表;

猜你喜欢

转载自blog.csdn.net/qq_41797451/article/details/80336559