GROUP BY Clause

GROUP BY groups rows that have the same values in specified columns and allows aggregate functions to be applied to each group.

SELECT department, COUNT(*)
FROM employees
GROUP BY department;

This groups employees by department and counts how many are in each.

← PrevNext →