文章目录
题目
Leetcode 2356. 每位教师所教授的科目种类的数量
代码(7.19 首刷自解)
能直接在count、sum里面用distinct,去重
# Write your MySQL query statement below
select teacher_id, count(distinct subject_id) cnt from Teacher t group by teacher_id;
Leetcode 2356. 每位教师所教授的科目种类的数量
能直接在count、sum里面用distinct,去重
# Write your MySQL query statement below
select teacher_id, count(distinct subject_id) cnt from Teacher t group by teacher_id;