GROUP BY Clause: This clause groups rows that have the same values in specified columns into summary rows.Example:
SELECT department_id, COUNT(*) AS employee_count
FROM employees
GROUP BY department_id;
Explanation: This query counts the number of employees in each department. The COUNT(*)
function counts all rows for each department_id
.
Leave a Reply