码迷,mamicode.com
首页 > 其他好文 > 详细

daan

时间:2014-08-19 16:06:44      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:io   ar   art   问题   ad   on   table   ui   

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);

daan,布布扣,bubuko.com

daan

标签:io   ar   art   问题   ad   on   table   ui   

原文地址:http://www.cnblogs.com/zhangwensi/p/3922091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!