编写两条SQL语句,高手请进

2024-12-26 21:48:22
推荐回答(2个)
回答1:

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

回答2:

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