SQL Tutorial

SQL ORDER BY Clause with Descending Order

sql order by clause with descending order
sql order by clause with descending order

SQL ORDER BY DESC (Descending Order)

The SQL ORDER BY clause sorts query results. By default, sorting is ascending. Add the DESC keyword to sort in descending (largest-first) order ÔÇö useful for top earners, latest dates, highest scores, and more.

Complete Python Course with Advance topics:-
SQL Tutorial:-

Syntax for Descending Order

SELECT Column1, Column2, ...
FROM TableName
ORDER BY ColumnName DESC;

Example 1: Sort Customers by Name DESC

SELECT * FROM customers ORDER BY Name DESC;

Example 2: Sort by Income DESC

SELECT * FROM customers ORDER BY Income DESC;

Mixing ASC and DESC

-- City A-Z, salary high to low within each city
SELECT * FROM employees
ORDER BY City ASC, Salary DESC;

Top-N Records with ORDER BY DESC

-- Top 5 highest-paid employees (MySQL)
SELECT * FROM employees ORDER BY Salary DESC LIMIT 5;

NULL Behavior

NULLs come first in DESC by default in some databases (MySQL) and last in others (Oracle). Use NULLS LAST or NULLS FIRST (Oracle/PostgreSQL) for explicit control.

Download New Real Time Projects:- Click here
Complete Advance AI topics:-

Conclusion

ORDER BY DESC is essential for top-N queries and reverse chronology. Combine with ASC and multiple columns for fine sorting. For more SQL guides, stay tuned to .

order by ascending sql
sql order by descending multiple columns
sql order by desc with where
sql order by descending not working
sql order by descending example
group by and order by in sql
sql order of operations
order by desc w3schools

Source Code Available

Interested in This Project?

Get the complete source code for this project at a very affordable price — perfect for your portfolio, college submission, or learning. Message us on WhatsApp and we'll get back to you instantly!

Full source code included Step-by-step setup guide Instant delivery on WhatsApp Instant reply on WhatsApp
Chat on WhatsApp

We usually reply within a few minutes

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat with us