第一题:
select a.name
from employee a left join
(select t.dptid,avg(t.salary) avgsal
from employee t
group by t.dptid) b on a.dptid = b.dptid
where a.salary > b.avgsal
第二题
select count(a.name),a.dptid
from employee a left join
(select t.dptid,avg(t.salary) avgsal
from employee t
group by t.dptid) b on a.dptid = b.dptid
where a.salary > b.avgsal
group by a.dptid
第三题:
select avg(t.salary)
from employee t
where t.salary > 6000
我也不知道 哈哈哈,因为这是我没上过
看不清楚