SQL查询语句,题目如截图,求答案

2025-03-04 18:40:26
推荐回答(1个)
回答1:

  1. 2018年总工资

    select sum(s_money) from c where s_date like '2018%'

  2. 2018年平均工资

    select avg(s_money) from c where s_date like '2018%'

  3. 2018年年收入大于10万的员工

    select b.e_name,t.s_money from b,(select e_id,sum(s_money) as s_money from c where s_date like '2018%' group by e_id) t where b.e_id = t.e_id and t.s_money >100000

  4. 2019年1月各部门的平均工资

    select d_name,avg(c.s_money) as s_money from a,b,c where a.d_id = b.d_id and b.e_id = c.e_id and s_date = '201901' group by d_name

有问题请追问