MySQL - Should I use INNER JOIN or WHERE?
Should I use INNER JOIN or WHERE in MySQL?
We have two queries:
SELECT *
FROM
tableA, tableB
WHERE
tableA.foreignkey = tableB.primarykey
AND (other conditions);
or
SELECT *
FROM
tableA INNER JOIN tableB
ON tableA.foreignkey = tableB.primarykey
WHERE
(other conditions);
These two clauses are equivalent but when using INNER JOIN
, it’s easier to read and modify, related to some other JOIN
clauses such as OUTER JOIN
or STRAIGHT_JOIN
.
Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS.