mysql 求各部门的平均工资最大值和最小值
时间: 2023-06-03 10:03:06 浏览: 374
求最大值和最小值
好的,我可以回答这个问题。以下是MySQL查询语句:
求各部门平均工资的最大值:
SELECT MAX(avg_salary) FROM (SELECT AVG(salary) AS avg_salary FROM employees GROUP BY department_id) AS avg_salaries;
求各部门平均工资的最小值:
SELECT MIN(avg_salary) FROM (SELECT AVG(salary) AS avg_salary FROM employees GROUP BY department_id) AS avg_salaries;
请注意,这只是一个演示,实际上需要根据你的具体数据表和字段进行调整。
阅读全文