I want to ask what would I add to my query to select the ones that only taught one class. My table is:
Teacher Course
ID Name Course_ID Teacher_ID
1 George 1 1
2 Sam 2 2
3 Julie 3 1
I want to get the teacher ID who only taught one class. I have:
select teacher.id
from teacher, course
where teacher.id = course.teacher_id;
I was thinking of adding
having (count(course.teacher_id)) = 1
or
where count(t) = (select count(*) from course) and t = 0
but I get an "invalid use of group error". How do I change it to fix my query?