I need to select exam results of students in class 7A, but need to look into another table (student_profile) to identify students in 7A (identify by student_id). I wonder which of the following method will be faster, assume index for student_id is created in both tables:
Method 1:
select * from exam_results r
where exists
(select 1
from student_profile p
where p.student_id = r.student_id
and p.class = '7A')
Method 2:
select * from exam_results
where student_id in
(select student_id
from student_profile
where class = '7A')
Thanks in Advance,
Jonathan