0
937views
Explain following term: Group by clause
0
2views

-Aggregate functions can be used for some group by clause in this case it will give summary information for that specific group.

Example: Display the maximum salary of all departments in company

SELECT department_id as Dept,
AVG(salary)as Avg
FROM   employees
GROUP BY department_id

DEPT AVG
10 34000
20 30000
30 25000
40 12000
• Nested Group functions

Group functions can be nested to a depth of two

Example, display the maximum average salary

SELECT MAX(AVG(Salary)) FROM employees GROUP BY department_id