leetcode

Leetcode submissions
git clone git://git.laack.co/leetcode.git
Log | Files | Refs | README

number-of-subjects-by-teacher.sql (239B)


      1 --Given a table with rows of the teacher_id, subject, and the department
      2 --return the number of subjects each teacher teaches.
      3 
      4 SELECT Teacher.teacher_id , COUNT(DISTINCT Teacher.subject_id) as cnt
      5 FROM Teacher
      6 GROUP By Teacher.teacher_id