Multiple choice technology programming languages

Which statements about subqueries are true?

  1. A subquery should retrieve only one row.

  2. A subquery can retrieve zero or more rows.

  3. Subqueries CANNOT be nested by more than two levels.

  4. A subquery can be used only in SQL query statements.

  5. A subquery CANNOT be used in an SQL query statement that uses group functions.

  6. When a subquery is used with an inequality comparison operator in the outer SQL statement,

Reveal answer Fill a bubble to check yourself
B,F Correct answer
Explanation

Subqueries can return zero, one, or multiple rows depending on context and operators used (B is true, disproving A). They can be nested beyond two levels in most databases (C is false). Subqueries can appear in various SQL statement types including DML and DDL, not just queries (D is false). They work with group functions (E is false). When using inequality operators with subqueries, single-row subqueries must be ensured or the ANY/ALL modifiers must be used (F is true, describing the inequality constraint requirement).

AI explanation

Both marked answers are correct per standard SQL semantics: a subquery can indeed return zero, one, or many rows depending on context, and when a subquery is compared using an inequality operator in the outer query, its SELECT list must contain exactly one column/expression. The second option's text is cut off mid-sentence in the database, but the underlying claim it is testing is the standard, correct one from this well-known question.