Which SQL clause is generally used to sort the final result of a query in ascending or descending order?

Options

  • A. GROUP BY
  • B. ORDER BY
  • C. HAVING
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. ORDER BY

Detailed Explanation

  • ORDER BY: Sorts the result set based on one or more columns or expressions.
  • ASC: Sorts in ascending order and is the default.
  • DESC: Sorts in descending order.
  • Example: SELECT * FROM employees ORDER BY salary DESC;