1.select AVG(e.salary) from EMP e, DEP d where e.depid=d.id and e.salary<400 and d.id=xxx
其中xxx就是DEP的id,假定emp表中有个depid字段,表示员工所属DEP
2. update EMP set salary=salary*1.10 where salary<400
select avg(salary) as a from emp where did=1 and salary<400
update emp set salary=salary*1.1 where salary<400
did 是员工的部门id