oracle一条语句查询出每个职位不同性别的员工的平均工资及每个职位的平均工资
时间: 2023-02-28 07:11:44 浏览: 151
oracle之查询语句
以下是 Oracle 查询语句,可以查询每个职位不同性别的员工的平均工资及每个职位的平均工资:
```
SELECT job, gender, AVG(salary) AS avg_salary
FROM employees
GROUP BY job, gender
UNION
SELECT job, 'Overall' AS gender, AVG(salary) AS avg_salary
FROM employees
GROUP BY job;
```
注意:需要使用的表名为 "employees",该表必须包含 "job", "gender", "salary" 字段。
阅读全文