What is the difference between the query
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons INNER JOIN Orders ON Persons.P_Id=Orders.P_Id ORDER BY Persons.LastName
and this one
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons, Orders WHERE Persons.P_Id=Orders.P_Id ORDER BY Persons.LastName
Advertisement
Answer
There is a small difference in syntax, but both queries are doing a join on the P_Id
fields of the respective tables.
In your second example, this is an implicit join, which you are constraining in your WHERE
clause to the P_Id
fields of both tables.
The join is explicit in your first example and the join clause contains the constraint instead of in an additional WHERE
clause.