Reputation: 13
List a count of the number of employees who work in either department 10 or 20, the average, minimum, and maximum employee salary in these departments, and a total of all their salaries combined (This question must be done by using one query)
MY CODE:
SELECT DEPTNO, AVG(SAL), MAX(SAL), MIN(SAL), SUM(SAL) AS TOTAL_SAL
FROM EMP
WHERE DEPTNO = 10 OR DEPTNO=20
GROUP BY DEPTNO;
Table Schema:
Upvotes: 1
Views: 66
Reputation: 267
So add a:
count(DEPTNO) as NumberEmployeesInDept
to your select and I think you will be done.
Upvotes: 1