Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explicit JOINs vs Implicit joins?

My Database Professor told us to use:

SELECT A.a1, B.b1 FROM A, B WHERE A.a2 = B.b2;

Rather than:

SELECT A.a1, B.b1 FROM A INNER JOIN B ON A.a2 = B.b2;

Supposedly Oracle don't likes JOIN-Syntaxes, because these JOIN-syntaxes are harder to optimize than the WHERE restriction of the Cartesian Product.

I can't imagine why this should be the case. The only Performance issue could be that the parser Needs to parse a few characters more. But that is negligible in my eyes.

I found this Stack Overflow Questions:

  • Is there an Oracle official recommendation on the use of explicit ANSI JOINs vs implicit joins?
  • Explicit vs implicit SQL joins

And this sentence in a Oracle Documentation: https://docs.oracle.com/cd/B19306_01/server.102/b14200/queries006.htm

Oracle recommends that you use the FROM clause OUTER JOIN syntax rather than the Oracle join operator.

Can someone give me up-to-date recommendations from Oracle with link. Because she don't acknowledges StackOverflow (here can answer everyone) and the 10g Documentation is outdated in here eyes.

If i am wrong and Oracle realy don't likes JOINS now than thats also ok, but i don't find articles. I just want to know who is Right.

Thanks a lot to everyone who can help me!

like image 662
Dominik Viererbe Avatar asked Oct 30 '18 09:10

Dominik Viererbe


People also ask

What is implicit joining?

Joins can also be performed by having several tables in the from clause, separated with commas , and defining the relationship between them in the where clause. This technique is called an Implicit Join (since it doesn't actually contain a join clause). All RDBMSs support it, but the syntax is usually advised against.

What type of join is implicit?

The implicit join syntax is “old-style” syntax, where each join operation is defined implicitly via the WHERE clause, using the so-called join columns (see the second statement in Example 6.57). Note – Use of the explicit join syntax is recommended. This syntax enhances the readability of queries.

What are the 4 types of joins in SQL?

Four types of joins: left, right, inner, and outer.

What are the 3 types of joins?

Basically, we have only three types of joins: Inner join, Outer join, and Cross join.


1 Answers

Your professor should speak with Gordon Linoff, who is a computer science professor at Columbia University. Gordon, and most SQL enthusiasts on this site, will almost always tell you to use explicit join syntax. The reasons for this are many, including (but not limited to):

  • Explicit joins make it easy to see what the actual join logic is. Implicit joins, on the other hand, obfuscate the join logic, by spreading it out across both the FROM and WHERE clauses.
  • The ANSI 92 standard recommends using modern explicit joins, and in fact deprecated the implicit join which your professor seems to be pushing

Regarding performance, as far as I know, both versions of the query you wrote would be optimized to the same thing under the hood. You can always check the execution plans of both, but I doubt you would see a significant difference very often.

like image 177
Tim Biegeleisen Avatar answered Nov 15 '22 07:11

Tim Biegeleisen