0

This is the table and I need to figure out how to get which faculty can teach more than one course? Let's call this table Majors, so what should write to find who can teach more than 2 courses?

Faculty_ID Course_ID
---------------------
2130       ISM 2000  
2130       ISM 3100  
2143       ISM 3112  
2143       ISM 3113  
3487       ISM 4212  
3487       ISM 4930  
4756       ISM 3112  
4756       ISM 3113  
4756       ISM 4930  
5233       ISM 3112  
5233       ISM 3150  
7854       ISM 2000  
7896       ISM 8745  
8745       ISM 6100  
8759       ISM 4212  
8759       ISM 6500 
Aaron Dietz
  • 10,137
  • 1
  • 14
  • 26
Sultan
  • 1
  • 3
  • Possible duplicate of [SQL Group By with an Order By](https://stackoverflow.com/questions/27983/sql-group-by-with-an-order-by) – Jan Oct 26 '18 at 22:16

1 Answers1

1

Use HAVING to filter grouped results:

select
    faculty_id, count(distinct course_id)
  from majors
  group by faculty_id
  having count(distinct course_id) > 2
The Impaler
  • 45,731
  • 9
  • 39
  • 76