0

Possible Duplicate:
INNER JOIN ON vs WHERE clause

INNER JOIN:


SELECT *
FROM PETS
INNER JOIN OWNER ON PETS.OWNER_ID = 1
AND OWNER.ID = 1

MULTIPLE TABLE SELECT:


SELECT *
FROM PETS, OWNER
WHERE PETS.OWNER_ID = 1
AND OWNER.ID = 1

  • Is one better than the other?
  • Faster than the other?

They seem to produce exactly the same results.

  • Is there any difference at all?

I am trying to learn the best methods. In using the join, I noticed that the exact same thing can be achieved with the multiple table call

Community
  • 1
  • 1
  • 1
    Is this code causing performance problems, or just curiosity? – Roman Feb 02 '13 at 04:55
  • No performance problems.... Yet. I am trying to learn the best methods. In using the join, I noticed that the exact same thing can be achieved with the multiple table call. –  Feb 02 '13 at 18:53
  • I read this "The second syntax has the unwanted possibility of a cross join: you can add tables to the FROM part without corresponding WHERE clause. This is considered harmful." Here>>> http://sqldatabases.deveronline.com/2012/24/explicit-vs-implicit-sql-joins.html If any one can ad the explanation as to how this is "considered harmful" part, that could be helpful to this question. But I still can't find any substantiating info on the deprecation of any syntax. –  Feb 02 '13 at 19:02

1 Answers1

0

read this answer about the difference between a cross join and an inner join Performance of inner join compared to cross join

Community
  • 1
  • 1
Bassam Mehanni
  • 14,796
  • 2
  • 33
  • 41