Group by Clause is used to break the data into Groups. Syntax:- SELECT Column1, aggregate_function(Column2) FROM TABLE GROUP BY Column1;
employees is the table, that i’m going to use. here making department_id columns records into groups.
- select department_id, using count aggregate function on department_id making department_id in groups.
- using max aggregate function on salary for counting maximum salary by department_id .
- if we use group by clause on column then we cant use non aggregate columns on query.
- After including employee_id in Group , No Error Found.
Happy Queries, Thanks.