2

Is there ever a case where a join will not return data that a FROM multiple tables with the same conditions returns?

e.g.

SELECT *
FROM TableNames as Names
INNER JOIN TableNumbers as Numbers on Names.ID = Numbers.ID

VS

SELECT *
FROM TableNames as Names, TableNumbers as Numbers
WHERE Names.ID = Numbers.ID

2 Answers2

2

An INNER JOIN (as in your first example) will always return the same data as your a cartesian join with a WHERE filter that uses the same join criteria (your second example).

However, note that this is not true for OUTER JOINs, where NULL values are filtered out in a cartesian join with a WHERE filter as join criteria.

Dan
  • 10,480
  • 23
  • 49
0

Simply, both the queries are same and do the same thing.

  1. Inner Join is generally considered more readable, especially when you join lots of tables.
  2. The WHERE syntax is more relational model oriented.
Veera
  • 3,412
  • 2
  • 14
  • 27