Autumn Offers - hours only!Up to 80% off on all courses and bundles.-Close
SQL Basics
Summary

Instruction

Great! We previously mentioned that rows are sorted in the ascending order by default. How do we change that? Take a look:

SELECT *
FROM employee
ORDER BY department DESC;

Note that we added the keyword DESC after the column name in the ORDER BY clause. Now, all rows will be sorted by the department in the descending order.

Exercise

Let's show the list of hotels in the reversed order.

Show the name and city of all hotels, sorted by the city name in the descending order.

Stuck? Here's a hint!

Type:

SELECT name, city
FROM hotel
ORDER BY city DESC;