-4

I have two statement sql for oracle 11gr2

sql1:

Select * from tableA inpt, tableB ptbs
where inpt.z='A'
AND (inpt.pid    = ptbs.pid
     AND  inpt.instcd = ptbs.instcd);

sql2:

Select * from tableA inpt, tableB ptbs
where inpt.z='A'
AND inpt.pid    = ptbs.pid
     AND  inpt.instcd = ptbs.instcd

Sql1 is faster than sql2?

The writing ... and ... and ... and ... Slowly write and (... and ... and (... and ... and ...))?

Similar to "or"?

2 Answers2

1

There is no difference here.

 where inpt.z='A'
    AND (inpt.pid    = ptbs.pid
         AND  inpt.instcd = ptbs.instcd);

or

where inpt.z='A'
AND inpt.pid    = ptbs.pid
     AND  inpt.instcd = ptbs.instcd

or

where inpt.pid    = ptbs.pid
     AND  inpt.instcd = ptbs.instcd and inpt.z='A'

All is the same.

I Love You
  • 268
  • 2
  • 8
0

It should probably just be written like:

SELECT *
FROM tableA inpt
INNER JOIN tableB ptbs
ON inpt.pid = ptbs.pid
WHERE inpt.instcd = ptbs.instcd
AND inpt.z = 'A'

This might be worth a review: INNER JOIN ON vs WHERE clause

kjmerf
  • 4,275
  • 3
  • 21
  • 29