Grouping Data with GROUP BY in MySQL

Published July 26, 2025 By Sai Sree Ram Gundepudi

GROUP BY Syntax

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

This groups employees by department and counts them.

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article