GROUP BY, HAVING is sorting data operators

GROUP BY

  • SQL Group by Clause is used to find count, sum, min and max values belonging to a particular category
  • SELECT employee_name,sum(salary) salary from salary GROUP BY employee_name;

HAVING

  • To filter out data produced by group by function, having command is used. Note that, having keyword should be used after group by.
  • SELECT employee_name,sum(salary) salary from salary group by employee_name having sum(salary) > 100000