Beginner

162. ORDER BY DESC

Learn how to sort SQL query results in descending order.

📘 Lesson 162 of 728 ⏱ 7 min 🎯 Beginner

ORDER BY DESC sorts query results from higher to lower values. For numbers, this means largest to smallest; for dates, latest to earliest.

Descending sorting is frequently required when identifying highest values, latest records, or top-performing categories.

A sales analyst can sort products by sales amount from highest to lowest.

SQL
SELECT
    EmployeeName,
    Salary
FROM Employees
ORDER BY Salary DESC;

DESC is commonly used for top salaries, highest sales, latest transactions, newest customers, and ranking reports.

  • DESC means descending order.
  • Numbers are sorted from high to low.
  • Dates are sorted from latest to earliest.
  • DESC is commonly used for rankings.
  • ORDER BY can contain multiple sort directions.
What does DESC mean in SQL?

DESC means descending order and sorts values from higher to lower or latest to earliest.

Where is DESC commonly used?

DESC is commonly used for rankings, highest values, latest dates, and top-performing records.

Have you finished this lesson?

Introduction to SQL – All Lessons