0

This is just a question regarding JOINS and the different ways that they can be written. I've come across both ways many of times before but have never understood why different people use the different layouts, is it just some people prefer one way over another or is it a case of one method is an older way of doing things or are there performance benefits of one format over the other or is it just down to the SQL your using, Oracle, MSSQL, MySQL etc.?

Example One:

SELECT 
m.name
, e.address
FROM member  m
, email e 
WHERE m.id = e.mid

Example Two:

SELECT
m.name
, e.address
FROM member m
INNER JOIN email e ON m.id = e.mid

No need to go into the usage of LEFT/RIGHT joins etc as I already understand these, just curious as to the above example and any feedback on which people think is the best to use.

llanato
  • 2,508
  • 6
  • 37
  • 59
  • I prefer the second one. It concentrates the criteria for joining the tables close to the table names and keeps the "WHERE" statement decluttered. – Nuno G Mar 25 '13 at 13:12

1 Answers1

0

They are the same, but with different JOIN syntax, so you wouldn't expect any performance difference between the two syntaxes.

The first one uses the old ANSI SQL-89 JOIN syntax, where the second one uses the ANSI SQL-92 JOIN syntax.

But, it is better to stick into the second one, see the following articles for more info:

Community
  • 1
  • 1
Mahmoud Gamal
  • 78,257
  • 17
  • 139
  • 164