| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?
Paul Vernon wrote:
>Pass, but it's interesting to note that given the EXISTS form of the query,
>DB2 optimises it to the same query as before.
>
>
>Original Statement:
>------------------
>SELECT P#, PNAME
>FROM P
>WHERE EXISTS
> (SELECT *
> FROM SP
> WHERE P.P# = SP.P#)
>
>
>Optimized Statement:
>-------------------
>SELECT DISTINCT Q2.P# AS "P#", Q2.PNAME AS "PNAME"
>FROM DB2.SP AS Q1, DB2.P AS Q2
>WHERE (Q2.P# = Q1.P#)
>
So it basically converts 'EXISTS' into a special kind of join....
Regards,
Lauri Pietarinen
Received on Tue Mar 04 2003 - 07:55:25 CST
![]() |
![]() |