Oracle Magazine, March/April 2019
Database Developer and DBA ETL ORACLE MAGAZINE MARCH APRIL 2019 113 Listing 13 Columns for PROMOTED_ LOCATIONS SQL desc PROMOTED_ LOCATIONS Name Null Type ID NOT NULL NUMBER CAMPAIGN NOT NULL VARCHAR2 128 PROMOTED_ REGION NOT NULL VARCHAR2 24 Note that there is no column called REGION and yet the SQL statement in Listing 12 with its references to the REGION column runs without error This is because the columns were not fully qualified in the SQL statement so it becomes logically equivalent to the text in Listing 14 Listing 14 Promotions on Black Friday SQL select sales 2 from sales 3 where sales region in 4 select sales region 5 from promoted_ locations 6 where promoted_ locations campaign BLACK FRIDAY In the absence of a REGION column in the PROMOTED_ LOCATIONS table in the subquery the reference to the column will then resolve to that of the outer SALES table On the assumption that there is at least one row in PROMOTED_ LOCATIONS the subquery becomes an always true result and thus all rows from the SALES table are
You must have JavaScript enabled to view digital editions.