How to aggregate data in sql?

clipboard.png
in the above table, if you want to find out the number of people in each department, what should you do? ask for divine guidance!
the result is like this:
number of employees in the department
Technical Department 23
Logistics 10

Sql
Mar.18,2021

use the group by statement:

select departmentName, count(*)
from tableName
group by departmentName;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f044-2c472.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f044-2c472.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?