在SQLServer 2005数据库中,要查询工资总额最高的部门信息,以下正确的sql 语句是()(选择一项)
已知:员工信息表(employee),部门信息表(department)员工信息表字段:员工ID,部门ID,姓名,薪水,其他信息部门信息表字段:部门ID,部门名称,其他信...
已知:员工信息表(employee),部门信息表(department)
员工信息表字段:员工ID,部门ID ,姓名,薪水,其他信息
部门信息表字段:部门ID,部门名称,其他信息
a) select s.dep_id,d.dep_name,s.d_salary
from(selelct e.dep_id,sum(e.salary)d_salary from employee e group by e.dep_id order by dep_salary desc)s,department d where rownum = 1 and s.dep_id
b) select top I s.dep_id d.dep_nane,s.dep_salary from (select e.dep_id,sum(e.salary)dep_salary from employee e group by e.dep_id)s,department d where s.dep_id=d.dep_id order by s.dep_salary desc
c) select top 1 e.dep_id,d.dep_name,s.dep_salary from(select e.dep_id,sum(e.salary)dep_salary from employee e group by e.dep_id)s,department d,employee e where e.dep_id=d.dep_id order by dep_salary desc
d) select top 1 e.dep_id,d.dep_name,s.dep_salary from(select e.dep_id,sum(e.salary)dep_salary from employee e group by e.dep_id order by dep_salary desc)s where s.dep_id=d.dep_id 展开
员工信息表字段:员工ID,部门ID ,姓名,薪水,其他信息
部门信息表字段:部门ID,部门名称,其他信息
a) select s.dep_id,d.dep_name,s.d_salary
from(selelct e.dep_id,sum(e.salary)d_salary from employee e group by e.dep_id order by dep_salary desc)s,department d where rownum = 1 and s.dep_id
b) select top I s.dep_id d.dep_nane,s.dep_salary from (select e.dep_id,sum(e.salary)dep_salary from employee e group by e.dep_id)s,department d where s.dep_id=d.dep_id order by s.dep_salary desc
c) select top 1 e.dep_id,d.dep_name,s.dep_salary from(select e.dep_id,sum(e.salary)dep_salary from employee e group by e.dep_id)s,department d,employee e where e.dep_id=d.dep_id order by dep_salary desc
d) select top 1 e.dep_id,d.dep_name,s.dep_salary from(select e.dep_id,sum(e.salary)dep_salary from employee e group by e.dep_id order by dep_salary desc)s where s.dep_id=d.dep_id 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询