Joining Tables Using WHERE Instead of JOIN
Yes, you can perform a JOIN in MySQL without using the JOIN keyword. This older syntax uses multiple tables in the FROM clause and specifies the join condition in the WHERE clause. It works, but it behaves differently for INNER and OUTER joins.
• Before ANSI JOIN syntax became standard, INNER JOINs were commonly written using WHERE.
• This behaves exactly like an INNER JOIN.
Example:
SELECT *
FROM users u, orders o
WHERE u.id = o.user_id;
• Returns only rows where both tables have matching values.
• LEFT JOIN or RIGHT JOIN cannot be expressed correctly with WHERE conditions.
• The WHERE clause filters out NULLs, turning the join into an INNER JOIN.
• Therefore, outer joins must use explicit JOIN ... ON syntax.
• JOIN ... ON keeps join logic separate from filtering logic.
• Clearer and more readable.
• Prevents accidental conversion of OUTER JOIN → INNER JOIN.
• ANSI-standard and recommended for modern SQL.
In summary: JOINs can be written using WHERE, but this is safe only for INNER JOINs. For LEFT/RIGHT OUTER JOINs, the explicit JOIN keyword must be used.