Thursday, 15 January 2015

sql - Is order of conditions important? -



sql - Is order of conditions important? -

select emp.empname,emp.empid, emp.empdepid,dept.deptid employee emp,department dept emp.empdepid=dept.deptid;

here in clause, order of conditions important? is, me different results?:

emp.empdepid = dept.deptid

or

dept.deptid = emp.empdepid

this order not important. db engine optimizer parse query , create execution plan. so, place way or another, optimizer rule in way anyway.

as matter of fact can test it. both execution plans , compare. here explained: how obtain query execution plan?

also, newer sql standards recommend using inner bring together ... on ... syntax , not list of tables in from

sql

No comments:

Post a Comment