17,089
社区成员
发帖
与我相关
我的任务
分享
create table empwork(empid varchar2(5),empname varchar2(8),salary number,deptname varchar2(20))
as
(select a.empid,a.empname,a.salary,a.deptname from emp a,department b where a.deptid=b.deptid and rjdate<=to_date('20100101','yyyymmdd'))
update empwork
set salary=salary+600
where empid in(select empid from empwork where salary<5000)
update empwork a
set salary=salary-400
where exists(select 1 from empwork where a.empid=empid and salary>8000)
insert into empwork
(
empno,empname,depcode,depname,sal,hiredate
)
select a.empno,
a.ename,
a.deptno,
b.dname,
case when a.sal <5000
then a.sal+600
when a.sal >8000
then a.sal-400
end,
a.hiredate
from emp a,dept b
where a.deptno = b.deptno
and a.hiredate <= date '2010-1-1';