Thursday 27 September 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...