Skip to content

580. Count Student Number in Departments 👍

1
2
3
4
5
6
7
8
SELECT
  Department.dept_name,
  COUNT(Student.student_id) AS student_number
FROM Department
LEFT JOIN Student
  USING (dept_id)
GROUP BY 1
ORDER BY 2 DESC, 1;