Result sets in SQL: is the output of every SELECT query a tabular relation (a table-like result set) that can be further queried?

Difficulty: Easy

Correct Answer: Correct

Explanation:


Introduction / Context:
The relational model views query outputs as relations (tables). SQL adopts this notion with “result sets.” This question checks whether you understand that regardless of complexity—joins, aggregates, subqueries—the SELECT statement returns a table-like structure.



Given Data / Assumptions:

  • We consider standard SELECT queries.
  • We include queries with joins, expressions, aggregates, and subqueries.
  • We exclude procedural constructs that print messages or raise errors.


Concept / Approach:
Every SELECT produces a rectangular result: zero or more rows and one or more columns, each column having a defined type. Even SELECT without FROM (in some DBMSs) returns a single-row, single-column table. ORDER BY can change presentation order, but the underlying structure remains a table. This property enables composability: nesting a SELECT inside another or materializing it as a view.



Step-by-Step Solution:

Recognize SELECT’s semantics: it projects columns and filters/joins rows.Understand that the output is a set (or multiset) of rows with named columns.Note that the result can be aliased in a subquery or view and queried again.UI presentation (grid, CSV) does not change the logical tabular nature.


Verification / Alternative check:
Wrap any SELECT as a derived table: SELECT * FROM (SELECT 1 AS n) AS q; The inner SELECT is a table expression, proving tabular output.



Why Other Options Are Wrong:

  • Restricting correctness to single-table queries is incorrect—joins still return a table.
  • Client tools may format results, but SQL semantics define them as tables.
  • ORDER BY is not required to obtain a table; it only orders rows.


Common Pitfalls:
Confusing scalar functions with queries; while functions can return a value, a SELECT’s output is a rowset even if it contains one row and one column.



Final Answer:
Correct

More Questions from Introduction to SQL

Discussion & Comments

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