STUDENT table contains a list of students in my school Database
LIBRARY_BOOK table contains the information of each Book that is with currently with any student.
each student is allowed only 1 book at a time.
I want to know
Library Book with each Class 7 Student.
I am using Microsoft SQL Server 2008 R2
I have few queries which looks almost similar but don't behave in same way.
Query 1 :
Select *
FROM STUDENT ST
LEFT JOIN LIBRARY_BOOK LB
ON ST.Student_Id = LB._Student_ID
WHERE ST.Class = 7
Query 2 :
Select *
FROM STUDENT ST
LEFT JOIN LIBRARY_BOOK LB
ON ST.Student_Id = LB._Student_ID
AND ST.Class = 7
Query 3 :
Select *
FROM STUDENT ST
LEFT JOIN LIBRARY_BOOK LB
ON ST.Student_Id = LB._Student_ID
AND ST.Class = 7
WHERE ST.Class = 7
Can someone explain the difference between these queries in terms of both Output and Performance.