答案 0 :(得分:0)
如果您想要对部门进行平均,请使用平均汇总函数来获得部门的平均值。
SELECT e.first_name,
e.Last_Name,
e.job_id,
e.Salary,
d.department_id,
d.department_name,
COUNT(*) OVER (PARTITION BY d.department_id) as NumEmployees,
AVG(Salary) OVER(PARTITION BY d.department_id) FROM employees e JOIN departments d ON e.department_id = d.department_id;