GROUP BY CLAUSE: This clause
is used to divide the table into number of subgroups based on a specific
column.
Syntax: SELECT {COLUMNS LIST} FROM TABLENAME
GROUP
BY COLUMN NAME
E.g.: SELECT
DEPTNO, MAX (SAL) AS HISAL, MIN (SAL) AS LOSAL,
SUM (SAL) AS TOTSAL,
AVG (SAL) AS AVGSAL FROM EMP
GROUP BY DEPTNO
DEPTNO HISAL LOSAL TOTSAL AVGSAL
10 15000
5000 30000 10000
20 20000
5000 25000 12500
No comments:
Post a Comment