SQL 1: select * from t1 join t2 on t1.f1 = t2.f2
SQL 2: select * from t1,t2 where t1.f1 = t2.f2
The results that they return are same. Are there any differences between them? For example, in how the DBMS runs them, or in the query plan?
There is no operational difference between the two queries.
However, the explicit join notation is the better style to learn and use; leave the other for (as yet unchanged) legacy code.
One is old style and one is new (ANSI) style. The main reason that I've found why you would want to use the new style is for standard support of outer joins. With the old style, outer joins are vendor-specific. New style has it standard:
select * from t1 left outer join t2 on t1.f1 = t2.f2
In your example, SQL 1 is the new and SQL 2 is the old style, btw.
Basically, there are no difference between the two queries in operation.
However, both have same execution plan and have same cost that mean both query take equal time to execute(same performance).
Use of join operator is a modern way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With