Difficulty: Easy
Correct Answer: ORDER BY
Explanation:
Introduction / Context:
Result ordering is different from grouping or filtering. SQL separates these concerns so that you can control the presentation of rows without changing which rows qualify or how aggregates are computed.
Given Data / Assumptions:
Concept / Approach:
ORDER BY instructs the DBMS to sort the final result set. You can specify ASC or DESC for each sort key. GROUP BY forms groups for aggregation and does not imply any particular output order unless ORDER BY is also used. Non-standard clauses like SORT BY or ALIGN BY are not part of ANSI SQL (though some systems may offer syntactic sugar).
Step-by-Step Solution:
Verification / Alternative check:
ANSI SQL grammar places ORDER BY after SELECT ... FROM ... WHERE ... GROUP BY ... HAVING.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
ORDER BY
Discussion & Comments