In an SQL SELECT statement, how must a subquery be enclosed syntactically?
-
Abraces -- {...}
-
BCAPITAL LETTERS
-
Cparenthesis -- (...)
-
Dbrackets -- [...]
Answer
Correct Answer: parenthesis -- (...)
Explanation
Introduction / Context:Subqueries are nested SELECT statements that return intermediate results to the outer query. They are commonly used in WHERE, FROM, and SELECT clauses.
Given Data / Assumptions:
- We are working with standard SQL syntax.
- We must identify the delimiter required for enclosing subqueries.
Concept / Approach:SQL syntax requires subqueries to be enclosed in parentheses. This groups the subquery as a unit, distinguishing it from the main query.
Step-by-Step Solution:
Check valid SQL syntax: SELECT ... WHERE column IN (SELECT ...).Parentheses enclose the inner SELECT.Other brackets/braces are not recognized in SQL syntax.Verification / Alternative check:ANSI SQL documentation shows parentheses around subqueries in all valid examples.
Why Other Options Are Wrong:Braces/brackets: Not part of SQL subquery syntax. CAPITAL LETTERS: SQL is case-insensitive, but capitalization does not define subqueries.
Common Pitfalls:Confusing SQL with programming languages that use braces or brackets.
Final Answer:parenthesis -- (...)