Thursday, September 27, 2018

sql - What's the difference between comma separated joins and join on syntax in MySQL?




For example if I were to have a table "Person" with a column "id" that references a column "id" in table "Worker"



What would the difference between these two queries be? They yield the same results.



SELECT * 
FROM Person
JOIN Worker
ON Person.id = Worker.id;



and



SELECT * 
FROM Person,
Worker
WHERE Person.id = Worker.id;



Thanks


Answer



There is no difference at all.



Second representation makes query more readable and makes it look very clear as to which join corresponds to which condition.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...