I have the following schema,
Student(FirstName,LastName,SID)
Enrolled(StudentID,CourseID)
Course(CID, CourseName,Department)
I need to figure out which students took more CSC classes than IT. The CSC and IT bit are found in the Department category. I have the following query which lists all the students who enrolled in courses and how many CSC courses they enrolled in.
select studentid,count(department) as cscclasses
from enrolled
left join course
on courseid = cid
and department = 'CSC'
group by studentid;
Not quite sure how to compare this count with those enrolled in IT courses.