JOIN two relations in SQL without using JOIN clause [closed]

1. Result:

Both the queries would definitely give you the same result

2. Which is better

It is recommended to use the first one. Because it is safer in many ways. For instance, if we have to perform INNER JOIN, using the second syntax:

SELECT * 
FROM users, books 
WHERE users.id = books.id

If you forgot the WHERE users.id = books.id, the query won't fail. But it will return a cross join and we may not notice this error.

However, using the first syntax:

SELECT * 
FROM users 
JOIN books ON users.id = books.user_id

If we forget the ON condition, we will get a syntax error. Moreover, doing a CROSS JOIN will be very comprehensive in first syntax:

SELECT *
FROM users CROSS JOIN books 

Than the second syntax.

Refer this Blog.

3. Performance:

As far as I'm aware, there is no performance difference between both the queries

Additional info:

The difference between the two queries is the JOIN syntax:

  • The first one use the ANSI-92 JOIN syntax.
  • The second one use the old ANSI-89 JOIN syntax.