On outer joins(lets take a left outer join in this case) how does adding a filter on the right side table work?
SELECT s.id, i.name FROM Student s
LEFT OUTER JOIN Student_Instructor i
ON s.student_id=i.student_id
AND i.name='John'
I understand that if the filter was on the Student
table it would be more like "Get all rows with name= John first and join the tables".
But I am not sure if that is the case if the filter is on the right side table(Student_Instructor
). How does the filter i.name='John'
gets interpreted?
Thank you
Should be the same as:
SELECT s.id FROM Student s
LEFT OUTER JOIN (Select * from Student_Instructor where name='John' ) i
ON s.student_id=i.student_id