Question: In which four clauses can a subquery be used? (Choose four.)
A. in the INTO clause of an INSERT statement
B. in the FROM clause of a SELECT statement
C. in the GROUP BY clause of a SELECT statement
D. in the WHERE clause of a SELECT statement
E. in the SET clause of an UPDATE statement
F. in the VALUES clause of an INSERT statement
Answer: B, D, E, F
But I think right answers are the following: A, B, D, E BUT NOT F. Is not it so???
No, B, D, E, F sounds correct.
Why do you thik A should be valid? The INTO is designating a target rowset, which cannot be a subquery. And in F you can use subqueries which return a scalar value just fine.
First of all we must acknowledge that a subquery returns a set of value tuples (rows): {(value_1_A, value_1_B, ...), (value_2_A, value_2_B, ...), ...}
A - The INTO clause expects a table name, not a set of values so you may not use a subquery. Note that this is not similar to B because you are allowed to query an anonymous table (a set of rows returned by a subquery), but it makes no sense to insert values into an anonymous table that will not be used.
F - The VALUES clause of the INSERT statement expects exactly what I said a subquery returns, a set of values.
The right answer will be B, D, E and F.
Here's some more info on subqueries: http://www.techonthenet.com/oracle/subqueries.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With