juniorT-SQL

What is ORDER BY clause?

Updated May 17, 2026

Short answer

ORDER BY sorts query results.

Deep explanation

It sorts data in ascending or descending order after filtering and grouping.

Real-world example

Sorting employees by highest salary.

Common mistakes

  • Assuming default order is guaranteed without ORDER BY.

Follow-up questions

  • Is ORDER BY expensive?
  • Can multiple columns be used?

More T-SQL interview questions

View all →