Which statement about Oracle and SQL-92 view definitions is NOT true?

Difficulty: Medium

Correct Answer: Oracle views cannot use the ORDER BY clause in view definitions.

Explanation:


Introduction / Context:
Views encapsulate SELECT queries and present virtual tables to consumers. Standards and vendor implementations impose rules on what clauses can appear directly in view definitions.



Given Data / Assumptions:

  • SQL-92 generally disallows ORDER BY directly in a basic view definition unless paired with a top-N limiting construct (vendor-specific).
  • Oracle implements CREATE VIEW and supports querying views like tables.
  • Some ORDER BY usage can be achieved via subqueries or top-N/fetch clauses in newer Oracle releases, but not as a guaranteed ordering attribute of the view.


Concept / Approach:
The idea that a view can guarantee sorted output is not portable; consumers should specify ORDER BY in their own SELECT. Saying “Oracle views cannot use ORDER BY in view definitions” is not universally correct in modern Oracle syntax (e.g., ORDER BY … FETCH FIRST in the view’s query), and ordering is not guaranteed unless the consumer query specifies it.



Step-by-Step Solution:

Recognize that CREATE VIEW is supported by Oracle (true).Views are queryable (true).SQL-92 disallows ORDER BY in the simplest view form (true in baseline standard).The blanket claim “Oracle views cannot use ORDER BY” is the least accurate statement when considering practical, modern usage and subquery patterns.


Verification / Alternative check:
Developers commonly embed ORDER BY in subqueries or use FETCH FIRST with ORDER BY within the view’s defining SELECT in recent Oracle versions; however, consumers should still specify ORDER BY for deterministic ordering.



Why Other Options Are Wrong:
CREATE VIEW support is standard in Oracle.
Views are queryable is intrinsically true.
SQL-92 ORDER BY limitation is historically true for bare view definitions.



Common Pitfalls:
Relying on a view’s embedded ordering for downstream queries; always include ORDER BY in the consumer query.



Final Answer:
Oracle views cannot use the ORDER BY clause in view definitions.

Discussion & Comments

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