Scenario : SQL Tuning [message #65538] |
Wed, 20 October 2004 01:33 |
BhavinShah
Messages: 105 Registered: February 2004
|
Senior Member |
|
|
Dear frends,
I have some question regarding sql tuning .
Scenario :
Table emp :
empid pk
deptid (fk of deptid of dept)
ename
Table Dept :
deptid pk
dname
Table emp_shift_time :
empid (fk of empid of emp)
shift_id (fk of shift_id of shift_master)
Table shift_master :
shift_id pk
shift_time
Now I want a ename,deptname,shifttime . I have used following query to obtain this o/p.
select e.ename,d.dname,sm.shift_time from emp e ,dept d, emp_shift_time est,shift_master sm
where e.empid=est.empid
and est.shift_id=sm.shift_id
and e.deptid=d.deptid
Now I want to optimize this query by avoiding a joins..Is there any way to this.
also i wanted to know if i change the order of join condition then what happens.. means
if i will use est.empid=e.empid instead of e.empid=est.empid
Can I write this query by other way.
Any Help will be greate Help for me.
Regards
Bhavin Shah
|
|
|
|