Coding Test

Leetcode - 580. Count Student Number in Departments

Indo Yoon


Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.


SELECT Department.dept_name, COUNT(Student.dept_id) AS student_number
FROM Student
RIGHT JOIN Department ON Student.dept_id = Department.dept_id
GROUP BY Department.dept_name
ORDER BY student_number DESC, dept_name