SQL Keyword DESC

The SQL keyword DESC is used to sort the result set in descending order, based on a specific column.

Sort By Single Column

The below SQL sorts the result set by customer name in descending order.

SELECT * FROM customers
ORDER BY customer_name DESC;

Sort By Multiple Columns

The below SQL sorts the result set by customer name and city, both in descending order.

SELECT * FROM customers
ORDER BY customer_name DESC, city DESC;

Related Links