View definitions and GROUP BY — evaluate the statement:\n“Standard SQL-92 views are constructed from SELECT statements that do not contain the GROUP BY clause.” Decide if this is correct or incorrect.

Difficulty: Easy

Correct Answer: Incorrect

Explanation:


Introduction / Context:
Views encapsulate SELECT queries. The question asks whether SQL-92 prohibits GROUP BY in view definitions. Understanding the difference between “can define” versus “can update through” is essential: aggregation affects updatability, not definability.



Given Data / Assumptions:

  • We are discussing definitional capability (CREATE VIEW ... AS SELECT ...), not necessarily updatability.
  • GROUP BY, HAVING, and aggregate functions may appear in SELECT statements.
  • Vendors implement different updatability rules for aggregate views.


Concept / Approach:
SQL-92 allows views to be defined using arbitrary SELECT statements, which may include GROUP BY. However, views that perform aggregation are typically not inherently updatable because grouping destroys the one-to-one correspondence with base rows. Hence, the statement that standard views are constructed only from SELECT without GROUP BY is incorrect; GROUP BY is allowed but usually produces a non-updatable view.



Step-by-Step Solution:

Distinguish definition from updatability.Recognize that CREATE VIEW accepts SELECT queries with GROUP BY.Understand that aggregation limits DML pass-through.Conclude the statement is incorrect as written.


Verification / Alternative check:
Try CREATE VIEW v AS SELECT dept_id, COUNT(*) AS c FROM emp GROUP BY dept_id; — this is valid in mainstream SQL systems, though INSERT/UPDATE via v will be restricted.



Why Other Options Are Wrong:

  • Limiting GROUP BY to multi-table joins or claiming “undetermined” misunderstands the syntax rules.
  • “Correct only for updatable views” mixes two separate topics; the stem asserts a blanket prohibition for standard views, which is false.


Common Pitfalls:
Confusing syntactic allowance with updatability; assuming anything not updatable is disallowed in a view definition.



Final Answer:
Incorrect

Discussion & Comments

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