What does ORDER BY mean?

In databases & SQL, ORDER BY means the SQL clause that sorts the rows of a result by one or more columns, in ascending (ASC) or descending (DESC) order.

phraseCore term

Databases & SQL vocabulary · SQL Statements and Queries

In Turkish: sıralama, ORDER BY ifadesi

Also used in: Software Engineering

How it is used

Written near the end of a SELECT: ORDER BY created_at DESC. Ascending is the default. Without ORDER BY the database does not promise any order, even if results look sorted. It is often used with LIMIT, TOP or FETCH FIRST to get the newest or largest rows.

Example sentences

  1. Add ORDER BY created_at DESC so the newest tickets appear first.

  2. The test passed locally but failed on CI because the query had no ORDER BY.

Common collocations

  • ORDER BY ... DESC
  • ORDER BY ... ASC
  • sort order
  • order by date

More terms: SQL Statements and Queries

Practise with graded reading

Reading at the right level is the fastest way to make new words stick. Pick free English books by level: