Group By

•Can divide rows in a table into smaller groups by using GROUP BY clause
•Must include the column un the GROUP BY clause
•Cannot use column alias in the GROUP BY clause

Select department_id, AVG (salary)

From employees

Group by department_id;





Group by on Multiple Columns

Select department_id, job_id, SUM (salary)
From employees
Group by department_id, job_id;






0 comments:

Post a Comment