Leetcode SQL-5024. number of unique subjcet taught by each teacherOn this page24. number of unique subjcet taught by each teacher Problem https://leetcode.com/problems/number-of-unique-subjects-taught-by-each-teacher/description/?envType=study-plan-v2&envId=top-sql-50 Solution select t.teacher_id, count(distinct t.subject_id) as cntfrom Teacher tgroup by t.teacher_id count distinct to not duplicate the subjects count