|
if object_id('a') is not null drop table a
go
CREATE TABLE a (
[teacherid] [varchar] (50),
[courseinfo] [varchar] (50),
[coursename] [varchar] (50),
[point] [float],
)
insert into a(teacherid,courseinfo,coursename,point) values('0001','0101011002_1_1','magmatic rock and metamorphic petrology_theory', 80.05)
insert into a(teacherid,courseinfo,coursename,point) values('0002','0101011003_1_1','magmatology_theory',90.50)
insert into a(teacherid,courseinfo,coursename,point) values('0003','0101011006_1_1','metamorphic petrology_theory',90.50)
insert into a(teacherid,courseinfo,coursename,point) values('0004','0101011007_1_1','geoinformatics_theory',90.50)
go
if object_id('b') is not null drop table b
go
CREATE TABLE b (
[teacherid] [varchar] (50),
[courseinfo] [varchar] (50),
[coursename] [varchar] (50),
[point] [float],
)
insert into b(teacherid,courseinfo,coursename,point) values('0001','0101011002_1_1','magmatic rock and metamorphic petrology_theory', 83.05)
insert into b(teacherid,courseinfo,coursename,point) values('0003','0101011006_1_1','metamorphic petrology_theory',95.50)
insert into b(teacherid,courseinfo,coursename,point) values('0005','0101011008_1_1','geoinformatics_theory',90.50)
go
select * from a
select * from b
----The above section of the generated table
---This answer is interesting, but it has not fully answered my question
insert into a
select teacherid,courseinfo,coursename,0
from b
where teacherid not in(select distinct teacherid from a |
|