Machine-translated by Google. Questions are authored in English.
Top

Discussion

To sort the results of a query use:

  • A.SORT BY.
  • B.GROUP BY.
  • C.ORDER BY.
  • D.None of the above is correct.

Answer: C

Correct answer: ORDER BY.

ORDER BY is the only clause that sorts a result. It comes last in the statement, after WHERE, GROUP BY and HAVING, because sorting is the final step applied to what those have produced.

This is worth stating plainly: a relation is a set, so without ORDER BY the rows come back in whatever order the engine finds convenient, and that order can change when data grows or an index is added. Code that depends on an unspecified order works until it does not.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.