Your WHERE clause needs to refer to one of the tables you have selected or joined, which are enrolls
and teaches
. So you would have to do something like WHERE teaches.instructor_id=(SELECT instructor_id FROM Instructor WHERE name='john');
PS: You might also want to throw a DISTINCT in your top level select.
manpreet
Best Answer
2 years ago
I have this database of college. I have to Retrieve student-ids of students who have taken a class with an instructor named “John”.
SO far
but this is not working.