LeetCode刷题实战580:统计各专业学生人数
程序IT圈
共 1243字,需浏览 3分钟
· 2022-04-17
解题
# Write your MySQL query statement below
select dept_name, ifnull(t.people,0) student_number
from department d left join
(
select dept_id, count(*) people
from student
group by dept_id
) t
on d.dept_id = t.dept_id
order by student_number desc, dept_name
评论