?LeetCode刷題實(shí)戰(zhàn)580:統(tǒng)計(jì)各專業(yè)學(xué)生人數(shù)


解題
# 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
LeetCode1-560題匯總,希望對你有點(diǎn)幫助!
LeetCode刷題實(shí)戰(zhàn)561:數(shù)組拆分 I
LeetCode刷題實(shí)戰(zhàn)562:矩陣中最長的連續(xù)1線段
LeetCode刷題實(shí)戰(zhàn)563:二叉樹的坡度
LeetCode刷題實(shí)戰(zhàn)564:尋找最近的回文數(shù)
LeetCode刷題實(shí)戰(zhàn)565:數(shù)組嵌套
LeetCode刷題實(shí)戰(zhàn)566:重塑矩陣
LeetCode刷題實(shí)戰(zhàn)567:字符串的排列
LeetCode刷題實(shí)戰(zhàn)568:最大休假天數(shù)
LeetCode刷題實(shí)戰(zhàn)569:員工薪水中位數(shù)
LeetCode刷題實(shí)戰(zhàn)570:至少有5名直接下屬的經(jīng)理
LeetCode刷題實(shí)戰(zhàn)571:給定數(shù)字的頻率查詢中位數(shù)
LeetCode刷題實(shí)戰(zhàn)572:另一棵樹的子樹
LeetCode刷題實(shí)戰(zhàn)573:松鼠模擬
LeetCode刷題實(shí)戰(zhàn)574:當(dāng)選者
LeetCode刷題實(shí)戰(zhàn)575:分糖果
LeetCode刷題實(shí)戰(zhàn)576:出界的路徑數(shù)
LeetCode刷題實(shí)戰(zhàn)577:員工獎金
LeetCode刷題實(shí)戰(zhàn)578:查詢回答率最高的問題
LeetCode刷題實(shí)戰(zhàn)579:查詢員工的累計(jì)薪水
評論
圖片
表情
