capypad
0 day streak
sql / beginner
Snippet

Sorting Results

The ORDER BY keyword is used to sort the result-set in ascending (ASC) or descending (DESC) order. Here, products are sorted from most expensive to cheapest.

snippet.sql
sql
1
2
3
SELECT product_name, price
FROM products
ORDER BY price DESC;
Breakdown
1
ORDER BY price DESC;
Sorts the results based on the price column in descending order.