What is the difference between:
SELECT *
FROM table_name1, table_name2
WHERE table_name1.t2_id = table_name2.id;
and
SELECT *
FROM table_name1
JOIN table_name2 ON table_name1.t2_id = table_name2.id;
?
NOTE: t2_id
is the foreign key of table_name1
that holds the value of the primary key (id
) of table_name2
.
I mean, these two different queries both return the same result. If they return same, then what's the point of using JOIN
?
P.S.: Please consider that I'm beginner in SQL.