Subqueries: Is a SELECT nested inside another SELECT and enclosed in square brackets [ ... ] called a subquery?
-
ADoes not apply — subqueries are enclosed in parentheses ( ... )
-
BApplies — subqueries use square brackets in standard SQL
-
CApplies only to SQL Server and MySQL
-
DApplies when the inner query is correlated
Answer
Correct Answer: Does not apply — subqueries are enclosed in parentheses ( ... )
Explanation
Introduction / Context:Subqueries are foundational in SQL. This question checks the correct syntax for enclosing them.
Given Data / Assumptions:
- Standard SQL encloses subqueries in parentheses.
- Square brackets are vendor-specific identifier delimiters (notably SQL Server), not subquery delimiters.
- Subqueries may appear in SELECT, FROM, WHERE, or HAVING.
Concept / Approach:A subquery is any SELECT embedded within another statement and must be enclosed in parentheses. Brackets may quote identifiers in some systems (e.g., [Order Details]) but are unrelated to subquery syntax.
Step-by-Step Solution:Identify the construct: inner SELECT inside an outer statement.Recall standard syntax: (SELECT ...).Conclude that square brackets are incorrect for subquery delimiting.
Verification / Alternative check:All major RDBMS documentation shows parentheses around subqueries.
Why Other Options Are Wrong:Vendor support does not change this rule; correlation affects dependencies, not delimiters.
Common Pitfalls:Confusing identifier quoting with subquery syntax; forgetting to alias subqueries in FROM.
Final Answer:Does not apply — subqueries are enclosed in parentheses ( ... )