How A Select Statement Works?

From: (wrong string) ªü´ö Thenardier <Thenardier_at_POBoxes.com>
Date: 1997/11/28
Message-ID: <347ee7eb.555157_at_news.netvigator.com>#1/1


Suppose i have a SELECT statement like this:

SELECT tableA.colA
FROM tableA
WHERE tableA.colX IN

   (SELECT tableB.colB
    FROM tableB
    WHERE tableB.colY IN

       (SELECT tableC.colC
        FROM tableC
        WHERE tableC.Type = 'A))

How would it work? Would it start from tableC, select all data in colC which match the criteria, then compare with data in colY in tableB and so on? If that's the way it works, then after the data in tableC.colC is SELECTed, would it exist in form of 'variables', eg, (C1, C2, C3, C4, etc). Or else?

Then i have 2 tables, tableA and tableB and a SELECT statement. These are their content.

tableA: (Code, Type, Num1, Num2, Num3, Date1) tableB: (Code, CodeDesc,

SELECT tableA.Code, tableB.CodeDesc, tableA.Num1, tableA.Num2 FROM tableA, tableB

WHERE tableA.Code = tableB.Code AND    /* Criteria 1 */
      tableA.Type = 'E'         AND    /* Criteria 2 */
      tableA.Num1 > 0           AND    /* Criteria 3 */
      (tableA.Date1 BETWEEN sysdate AND 
                            dAnyDateBefore)   /* Criteria 4 */

When executing the statement above, would it start the comparison job from Criteria 4, then Criteria 3, 2, 1 or from Criteria 1 and so on?

What would be the sequences that access tableA and tableB? tableA.record1 (A1) -> tableB.record1 (B1) -> B2 ->B3 ... and A2 -> B1 -> B2 -> B3 ... Or like this:
A1 -> B1 -> A2 -> B1 -> A3 -> B1 ...?
More importantly, will this sequences repeat for *each criteria*?

Anyone can enlighten me? Or
Any *good* book can possibly answer my questions?

Thanx very very much!

Thenard Received on Fri Nov 28 1997 - 00:00:00 CET

Original text of this message