QuestionQ187

VerifiedManipulating Data

Refer to the exhibit and review the structures of the CUSTOMERS and SALES tables.

Question Image

Consider the following SQL statement:

UPDATE (SELECT prod_id, cust_id, quantity_sold, time_id  
FROM sales)  
SET time_id = '22-MAR-2007'  
WHERE cust_id = (SELECT cust_id  
                 FROM customers  
                 WHERE cust_last_name = 'Roberts' AND  
                       credit_limit = 600);  

Which statement is true about executing this UPDATE statement?

Explanation

Oracle allows an UPDATE to target the columns returned by an updatable subquery. Because the subquery selects columns from only SALES and has no constructs that make it non-updatable, TIME_ID can be changed. The WHERE clause may contain a subquery, and the update target exposes only the columns in its select list, limiting modifications through that target to those columns.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!