35. Count Rows Per Group
MediumDatabases~10 min
Return each department_id together with how many employees it has.
Return two columns: the department id, then the count. Skip the employee with no department.
Examples
Example 1
- Input:
- employees
- Output:
- 1 | 3, 2 | 2, 3 | 2
Constraints
Return exactly two columns: department_id, then the count.Exclude rows where department_id is NULL.Row order does not matter.