Optimizing SELECT Statements although the join expression here can be interpreted unambiguously without them. In our extended syntax, the parentheses in  (t2, t3)  of the second query are required, although theoretically the query could be parsed without them: We still would have unambiguous syntactical structure for the query because  LEFT JOIN  and  ON  play the role of the left and right delimiters for the expression  (t2,t3) . The preceding examples demonstrate these points: •For join expressions involving only inner joins (and not outer joins), parentheses can be removed and joins evaluated left to right. In fact, tables can be evaluated in any order. •The same is not true, in general, for outer joins or for outer joins mixed with inner joins. Removal of parentheses may change the result. Queries with nested outer joins are executed in the same pipeline manner as queries with inner joins. More exactly, a variation of the nested-loop join algorithm is exploited. Recall the algorithm by which the nested- loop join executes a query (see Section 8.2.1.7, “Nested-Loop Join Algorithms” ). Suppose that a join query over 3 tables  T1,T2,T3  has this form: Here,  P1(T1,T2)  and  P2(T3,T3)  are some join conditions (on expressions), whereas  P(T1,T2,T3)  is a condition over columns of tables  T1,T2,T3 . The nested-loop join algorithm would execute this query in the following manner: The notation  t1||t2||t3  indicates a row constructed by concatenating the columns of rows  t1 ,  t2 , and  t3 . In some of the following examples,  NULL  where a table name appears means a row in which NULL  is used for each column of that table. For example,  t1||t2||NULL  indicates a row constructed by concatenating the columns of rows  t1  and  t2 , and  NULL  for each column of  t3 . Such a row is said to be NULL -complemented. Now consider a query with nested outer joins: For this query, modify the nested-loop pattern to obtain: 1664 SELECT * FROM T1 LEFT JOIN (T2 LEFT JOIN T3 ON P2(T2,T3)) ON P1(T1,T2) WHERE P(T1,T2,T3) FOR each row t1 in T1 { BOOL f1:=FALSE; FOR each row t2 in T2 such that P1(t1,t2) { BOOL f2:=FALSE; FOR each row t3 in T3 such that P2(t2,t3) { IF P(t1,t2,t3) { t:=t1||t2||t3; OUTPUT t; } f2=TRUE; f1=TRUE; FOR each row t1 in T1 { FOR each row t2 in T2 such that P1(t1,t2) { FOR each row t3 in T3 such that P2(t2,t3) { IF P(t1,t2,t3) { t:=t1||t2||t3; OUTPUT t; } } } } SELECT * FROM T1 INNER JOIN T2 ON P1(T1,T2) INNER JOIN T3 ON P2(T2,T3) WHERE P(T1,T2,T3)