公司中的员工信息存储在关系中
null
Employee (name, sex, salary, deptName)
考虑下面的SQL查询
select deptName from Employee where sex = 'M' group by deptName having avg (salary) > (select avg (salary) from Employee)
它返回所属部门的名称 (A) 平均工资高于公司的平均工资 (B) 男性员工的平均工资高于公司所有男性员工的平均工资 (C) 男性员工的平均工资高于同一部门员工的平均工资
(D) 男性员工的平均工资高于公司的平均工资 答复: (D) 说明: 在这个SQL查询中,我们有
select deptName --------------- Select the department name from Employee ---------------- From the database of employees where sex = 'M' --------------- Where sex is male (M) group by deptName ------------- Group by the name of the department having avg (salary) > (select avg (salary) from Employee) ----- Having the average salary greater than the average salary of all employees in the organization.
因此,这个查询将返回所有部门的名称,其中男性员工的平均工资高于公司所有员工的平均工资。
因此,D是正确的选择。
如果你在上面的帖子中发现任何错误,请在下面发表评论。 这个问题的小测验
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END