The following command will calculate the average earnings of the departments. It will not be too useful, because it will not be visible, which corresponds with which the department average.
SELECT AVG (SAL) FROM EMP GROUP BY DEPTNO;
To correct this command, put the selection list the number of the SELECT clause of the department:
SELECT DEPTNO, AVG (SAL) FROM EMP GROUP BY DEPTNO;
The selection list SELECT clause can occur only column names, which are subject to the GROUP BY clause, unless they occur as an argument to the function grouping.
No comments:
Post a Comment