用oracle怎样查询每个部门的部门编号,部门名称,平均工资,最高工资和最低工资

2025-01-31 10:28:49
推荐回答(4个)
回答1:

select e_id,e_name,avg(salary),max(salary),min(salary)from dep,emp where dep.d_id=emp.d_id group by e_id,e_name;

回答2:

select e_id,e_name,avg(salary),max(salary),min(salary) from dep,emp
where dep.d_id=emp.d_id
如果不是你字段有错误,就是from左右没有空格吧

回答3:

select dep.d_id, dep.d_name, avg(emp.salary), max(emp.salary), min(emp.salary) from dep, emp where dep.d_id=emp.d_id group by emp.d_id

回答4:

group by e_id