Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> SQL question
I was messing around with SQL, something that I am not very good with, when
I ran into something I felt was strange. The SQL from both statements can
be seen below, along with their execution plans. I do not quit understand
why the 2nd query came back with 3 rows. I know its from user error, but
shouldn't Oracle just ignore the test1 table in the second query?
SQL> select a.first_name from test2 a where a.id_number = 2; FIRST_NAME
SQL> select a.first_name from test2 a , test1 c where a.id_number = 2; FIRST_NAME
Execution Plan (1st statement)
0 SELECT STATEMENT Optimizer=CHOOSE 1 0 TABLE ACCESS (FULL) OF 'TEST2' Execution Plan (2nd statement)
0 SELECT STATEMENT Optimizer=CHOOSE 1 0 NESTED LOOPS
2 1 TABLE ACCESS (FULL) OF 'TEST1' 3 1 TABLE ACCESS (FULL) OF 'TEST2'Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlReceived on Thu May 06 2004 - 16:13:21 CDT
-----------------------------------------------------------------
![]() |
![]() |