23 - 每位教师所教授的科目种类的数量
- 考点: 排序和分组
sql
select
teacher_id,count(distinct subject_id) cnt
from
Teacher
group by
teacher_id;
select
teacher_id,count(distinct subject_id) cnt
from
Teacher
group by
teacher_id;