一、表之间的连接(左、右、内、外连接)
左连接(右表只显示两个表中都具有相同a.emp_id = s.hjempid,左表全部列出)
select * from employeehj a left join employeehj1 s on a.emp_id = s.hjempidselect * from employeehj a, employeehj1 s where a.emp_id = s.hjempid(+)
右连接(左表只显示两个表中都具有相同a.emp_id = s.hjempid,右表全部列出)
select * from employeehj a right join employeehj1 s on a.emp_id = s.hjempid
select * from employeehj a , employeehj1 s where a.emp_id(+) = s.hjempid
内连接(只显示两个表中都具有相同a.emp_id = s.hjempid)
select * from employeehj a inner join employeehj1 s on a.emp_id = s.hjempid
外链接(两个表中数据全部显示出来,如果没有匹配到另一张表中得数据,就与NULL匹配)
select * from employeehj a full join employeehj1 s on a.emp_id = s.hjempid
select * from employeehj a full outer join employeehj1 s on a.emp_id = s.hjempid
二、case when else end
select t.class ,sum(case )