Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL question

RE: SQL question

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Fri, 7 May 2004 10:19:23 -0400
Message-ID: <A186CBDC8B1D61438BC50F1A77E91F73075BD6BB@xchgbrsm1.corp.espn.pvt>


Does select count(*) from test2 comes back with 3 rows? If so, this is classic Cartesian join. You have a join in FROM clause but no join clause in WHERE ...

Raj



--------=20

Rajendra dot Jamadagni at nospamespn dot com=20 All Views expressed in this email are strictly personal.=20 select standard_disclaimer from company_requirements;=20 QOTD: Any clod can have facts, having an opinion is an art !

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Mike Schmitt Sent: Thursday, May 06, 2004 5:16 PM
To: oracle-l_at_freelists.org
Subject: SQL question=20

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 =3D 2; FIRST_NAME



tom

SQL> select a.first_name from test2 a , test1 c where a.id_number =3D = 2;
FIRST_NAME



tom
tom
tom

Execution Plan (1st statement)


    0 SELECT STATEMENT Optimizer=3DCHOOSE     1 0 TABLE ACCESS (FULL) OF 'TEST2' Execution Plan (2nd statement)


    0 SELECT STATEMENT Optimizer=3DCHOOSE     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

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html

-----------------------------------------------------------------

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Fri May 07 2004 - 09:17:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US