Subqueries: Is a SELECT nested inside another SELECT and enclosed in square brackets [ ... ] called a subquery?

Difficulty: Easy

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 ( ... )

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion