SQL: Employee Count by Department

Medium
SQL — Aggregation SQL GROUP BY COUNT
Count employees in each department.

Constraints

Write standard SQL (MySQL 8.0 compatible).

Examples

Example 1:
Input: dept_id name 1 Ahmed 1 Sara 2 Omar
Output:
Example 2:
Input: dept_id name 1 Ahmed 1 Sara 2 Omar
Output:

Hints

GROUP BY department with COUNT.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.