1Z0-061 · Question #304
Which three statements are true regarding subqueries? (Choose three.)
The correct answer is A. Subqueries can contain GROUP BY and ORDER BY clauses. B. Main query and subquery can get data from different tables. F. Multiple columns or expressions can be compared between the main query and subquery. SUBQUERIES can be used in the SELECT list and in the FROM, WHERE, and HAVING clauses A subquery can have any of the usual clauses for selection and projection. The following are required clauses: The following are optional clauses: The subquery (or subqueries) within a…
Question
Which three statements are true regarding subqueries? (Choose three.)
Options
- ASubqueries can contain GROUP BY and ORDER BY clauses.
- BMain query and subquery can get data from different tables.
- CMain query and subquery must get data from the same tables.
- DSubqueries can contain ORDER BY but not the GROUP BY clause.
- EOnly one column or expression can be compared between the main query and subquery.
- FMultiple columns or expressions can be compared between the main query and subquery.
How the community answered
(28 responses)- A75% (21)
- C7% (2)
- D14% (4)
- E4% (1)
Explanation
SUBQUERIES can be used in the SELECT list and in the FROM, WHERE, and HAVING clauses A subquery can have any of the usual clauses for selection and projection. The following are required clauses: The following are optional clauses: The subquery (or subqueries) within a statement must be executed before the parent query that calls it, in order that the results of the subquery can be passed to the parent.
Topics
Community Discussion
4The correct answers are A, B, and F. Subqueries absolutely can have GROUP BY and ORDER BY clauses, they can pull from completely different tables than the main query, and you can compare multiple columns or expressions between the main query and the subquery using row value constructors or correlated conditions, so C, D, and E are all false.
E tripped me up for a second because I kept thinking of single-row subqueries being the "normal" case, but F is dead right since you absolutely can compare multiple columns using a pairwise comparison. A, B, F are your three, just watch out for C which is the obvious trap since nothing stops the subquery from hitting a completely different table than the outer query.
Solid set, and the detail worth hammering home on the pairwise comparison in F is that the column count and positional order on the left side of the IN predicate must match the select list of the subquery exactly, because mismatched column order is the actual exam trap hiding inside that question, not just the concept of comparing multiple columns at once.
The answers are A, B, and F, and if you missed this one it is almost certainly because E lured you in. E sounds reasonable because single-column subqueries are what every intro example shows, but Oracle absolutely supports multi-column comparisons in the WHERE clause, so F is correct and E is wrong. D is a classic trap built by splitting a true statement in half, since a subquery may contain both GROUP BY and ORDER BY, which makes A true and D false. B trips up students who memorize correlated subquery examples where the inner query references the outer table, but "different tables" is not only allowed, it is the whole point of using a subquery in the first place, and C is simply the wrong-direction restatement of B designed to catch anyone who is skimming. File this under Blueprint Domain 3 and remember the mnemonic GOD, meaning subqueries can Group, Order, and Draw from Different tables.