首页 > 代码库 > daan
daan
1:
alter table TABLE_A
add constraint uinx_table_a unique (STUDID);
2:题目有问题,table_b 中没有张飞
update table_b t
set t.studscore = (select s.studscore
from table_a s
where s.studname = ‘李明‘)
where t.studname = ‘张飞‘;
commit;
3:
merge into table_b t
using table_a s
on (t.studid = s.studid and t.studname = s.studname and t.depart = s.depart)
when matched then
update set t.studscore = s.studscore
when not matched then
insert values (s.studid, s.studname, s.depart, s.studscore);
4:
alter table TABLE_B add studsex VARCHAR2(4);
5:
select *
from table_a
union
select *
from table_b b
where not exists (select *
from table_a a
where a.studid = b.studid
and a.studname = b.studname
and a.depart = b.depart);
6:
select *
from table_a t
where t.studid in (select a.studid
from table_a a
minus
select b.studid from table_b b);