Which three statements are true regarding subqueries? (Choose three.)
A.
Subqueries can contain GROUP BY and ORDER BY clauses.
B.
Main query and subquery can get data from different tables.
C.
Main query and subquery must get data from the same tables.
D.
Subqueries can contain ORDER BY but not the GROUP BY clause.
E.
Only one column or expression can be compared between the main query and subquery.
F.
Multiple columns or expressions can be compared between the main query and subquery.
Explanation:
SUBQUERIES can be used in the SELECT list and in the FROM, WHERE, and HAVING clauses of a query.
A subquery can have any of the usual clauses for selection and projection. The following are required clauses:
■ A SELECT list
■ A FROM clause
The following are optional clauses:
■ WHERE
■ GROUP BY
■ HAVING
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.
A. Subquery can’t do Order by
B. True
C. False
D. False Subquery can contain group by, not order by
E. False
F. True
B E
An ORDER BY clause can be used in the subquery appearing in the FROM clause, but not in the WHERE clause.