You can control the processing of the OPTIONAL keyword with parentheses. For example, in the following query the tables CUSTOMERS and ORDERS can be dropped:FROM "CUSTOMERS.sma" AS CUSTOMERS INNER JOIN "ORDERS.sma" AS ORDERS ON (CUSTOMERS.CUSTID = ORDERS.CUSTID) LEFT OPTIONAL INNER JOIN "ITEMS.sma" AS ITEMS ON
(ORDERS.ORDERID = ITEMS.ORDERID)In the following query, however, only the ORDERS table can be dropped because the join that includes the LEFT OPTIONAL keywords is enclosed in parentheses:FROM "CUSTOMERS.sma" AS CUSTOMERS INNER JOIN ("ORDERS.sma" AS ORDERS LEFT OPTIONAL INNER JOIN "ITEMS.sma" AS ITEMS ON (ORDERS.ORDERID = ITEMS.ORDERID) ) ON
(CUSTOMERS.CUSTID = ORDERS.CUSTID)((A RIGHT OPTIONAL JOIN B) RIGHT OPTIONAL JOIN C) RIGHT OPTIONAL JOIN DConsider the following query that includes the LEFT OPTIONAL keywords without parentheses:Tables A, B, and C can be dropped from the query. It is not possible, however, to drop table C without dropping tables A and B, or to drop table B without dropping table A, without using parentheses.Table C can be dropped from the query without dropping tables A and B. Table B can be dropped from the query without dropping table A.Consider the following query that includes the OPTIONAL keyword without the LEFT or RIGHT modifier:
|
|
Copyright Actuate Corporation 2012 |