ORDER BY

noun

say it: “OR-der BY” /ˈɔːrdər baɪ/

The part of a query that sorts the results by one or more columns.

What is ORDER BY in a relational database?

ORDER BY — A clause that sorts a query result by one or more expressions.

SELECT order_id, ordered_on
FROM purchase_order
ORDER BY ordered_on DESC;

In a sentence

  • “I added ORDER BY UnitPrice DESC so the most expensive product comes first.”

Level: Novice · More SQL terms at this level

Updated