B (false), depending EXPLAIN PLAN. no always is executed first.
C (false), ".o" is correlative
E (false) is possible multiple rows, an error more than row.
A and D is correct
AD; cannot be B, correlated subqueries are not executed before the parent (outer) query. Cannot be E, cannot set customer_name to multiple values for each row
BD,
A is incorrect only matching rows are updated, not all
C is invalid, statement correct structure
E is incorrect, in case multiple rows, error multiple rows in subquery
Actually i though in that way. But most likely customer table is PK. Orders table is FK. So it means the data that in the orders table also have in the customers table. And all rows will be updated.
most likely customer table is PK. Orders table is FK. So it means the data that in the orders table also have in the customers table. And all rows will be updated.
I think B is correct, subquery will execute for each row its right but also update will update for each raw after fulfilling the condition of subquery :)
Then how update will update each raw ? update will check its resources "subquery" is condition met ? yes ? then update after execute subquery and fully checking it.
The STATMENT update will execute first, then the action of updating will execute after the subquery. explain plan for
update ordersQ8 o
set customer_name =
(select cust_last_name
from customersQ8
where customer_id = o.customer_id);
SELECT plan_table_output
FROM TABLE(DBMS_XPLAN.DISPLAY('plan_table',null,'basic +note'));
Answer: A and D are correct.
B is not correct because the subquery is executed for each row in the ORDERS table, not before the update statement is executed.
C is not correct because the subquery is a correlated subquery, not a non-correlated subquery.
E is not correct because if the subquery selects multiple rows, the update statement will fail with a "subquery returns more than one row" error.
I think B is correct, as you said subquery will execute for each row its right but also update will update for each raw after fulfilling the condition of subquery :)
Then how update will update each raw ? update will check its resources "subquery" is condition met ? yes ? then update after execute subquery and fully checking it.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
meddheddy
Highly Voted 2 years, 3 months agoDrexan
Most Recent 2 months, 2 weeks agoRamileu
6 months, 2 weeks agoFredderik91
8 months agohmatinnn
12 months agoLee_jong_suk
1 year, 1 month agojm9999
1 year, 3 months agoHassanMkhlalati
1 year, 4 months agoFredderik91
1 year, 7 months agoHassanMkhlalati
1 year, 4 months agoGENO123
1 year, 6 months agoTofOra
11 months, 2 weeks agohmatinnn
1 year, 1 month agoNB196
1 year, 7 months agoraduM
1 year, 6 months agohmatinnn
1 year, 1 month agoCyberP
1 year, 7 months agoTofOra
11 months, 2 weeks agoRik92
1 year, 8 months agokuff
1 year, 8 months agokaplanek
1 year, 8 months agoalic_alex
1 year, 10 months agoMakub
1 year, 10 months agosubtype11
1 year, 11 months agoTheOracleWasTaken
1 year, 5 months agoCyberP
1 year, 7 months ago