-1

If I use syntax like this

SELECT * FROM table_1, table_2 WHERE table_1.id=table_2.id;

is this an INNER JOIN? In other words, is this equivalent to

SELECT * FROM table_1 INNER JOIN table_2 ON table_1.id=table_2.id;
3
  • yes, it is equivalent.
    – Taryn
    Jul 29, 2013 at 17:36
  • 1
    see this question: stackoverflow.com/questions/1018822/…
    – Zak
    Jul 29, 2013 at 17:37
  • Thanks Zak. I worried that this was a duplicate but couldn't condense my question down to a search that answered my question.
    – Bill
    Jul 29, 2013 at 18:05

2 Answers 2

2

Short answer: Yes, it is the same.

Most RDBMS will eventually process both syntax the same way.

Using the INNER JOIN is considered to be better readable, and also is the ANSI standard.

2
  • The other syntax is ANSI standard as well ;) Jul 29, 2013 at 18:18
  • I know, I just didn't put it in there to avoid a religious debate about it! :-)
    – Bjoern
    Jul 29, 2013 at 18:26
1

For simple cases like this, it appears that the MySQL engine will optimize in the same way. I figured this out by running

DESCRIBE SELECT * FROM table_1, table_2 WHERE table_1.id=table_2.id;

and

DESCRIBE SELECT * FROM table_1 INNER JOIN table_2 ON table_1.id=table_2.id;

which tells you a bit about how the query will run.

Not the answer you're looking for? Browse other questions tagged or ask your own question.