Suppose I have two tables,
Student Test
Id Name TestId Type StudentId
-- ---- ------ ---- ---------
1 Mark 774 Hard 1
2 Sam 774 Hard 2
3 John 775 Easy 3
Now I need to find these students (student ID, name and testid) who accepted the "hard" type of test in MySql.
Which one is better (in terms of performance)?
1.Select student.id,student.name,test.testid
from student
join test
on test.studentid=student.id and test.type='hard'
2.Select student.id,student.name,test.testid
from student
join test
on test.studentid=student.id
where test.type='hard'
Can I find out the reason? (Suppose millions of students and millions of test types)
source
share