Which SQL clause is used to sort the result set?

Study for the IT Operations Management (ITOM) Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

Which SQL clause is used to sort the result set?

Explanation:
Sorting the result set is done with ORDER BY. This clause arranges rows based on the values in one or more columns. By default it uses ascending order, but you can specify DESC to sort descending (and ASC explicitly if you prefer). You can also sort by multiple keys, separated by commas. For example, SELECT * FROM employees ORDER BY salary DESC; will list employees from highest to lowest salary. If you want a secondary sort, you could use ORDER BY department, name ASC. Other options don’t sort: GROUP BY gathers rows into groups rather than ordering them; SORT BY isn’t standard SQL in most systems; FILTER BY represents filtering rather than ordering (WHERE is used for filtering).

Sorting the result set is done with ORDER BY. This clause arranges rows based on the values in one or more columns. By default it uses ascending order, but you can specify DESC to sort descending (and ASC explicitly if you prefer). You can also sort by multiple keys, separated by commas.

For example, SELECT * FROM employees ORDER BY salary DESC; will list employees from highest to lowest salary. If you want a secondary sort, you could use ORDER BY department, name ASC.

Other options don’t sort: GROUP BY gathers rows into groups rather than ordering them; SORT BY isn’t standard SQL in most systems; FILTER BY represents filtering rather than ordering (WHERE is used for filtering).

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy