举例1:
insert into table_b(time,score,totalscore) select time,score,sum(score) over (order by time) from table_a
举例2:
insert into JobInfo_analysis(Salary,address,jobname,company,companysize,companytype,Educational,remak,Releasetime,created,id,LinkStatus,Reply,MyNote,LoveLevel) select Salary,address,jobname,company,companysize,companytype,Educational,remak,Releasetime,created,id,LinkStatus,Reply,MyNote,LoveLevel from JobInfo where address like'%北京%' and (jobname like'%ios%' or jobname like'%iphone%' or remak like '%ios%' or remak like 'iphone') and cast(substr(Salary,7,12) as int) >= 20001 and cast(substr(Salary,7,12) as int) <= 35000 and company not like '%咨询%' and company not like '%顾问%' and company not like '%猎头%' and company not like '%管理%' and company not like '%猎聘%' and company not like '%某公司%' and company not like '%人力资源%' and company not like '%人才服务%'
总结:
SQL数据库中把一个表中的数据复制到另一个表中
1、如果是整个表复制表达如下:
insert into table1 select * from table2
2、如果是有选择性的复制数据表达如下:
insert into table1(column1,column2,column3...) select column1,column2,colunm3... from table2
3、一个数据库中的表中的数据复制到另一个数据库中的一个表,使用方法如下:
insert into 数据库A.dbo.table1(col1,col2,col3...) select col1,col2,col3... from 数据库B.dbo.table2