Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
SQL Basics
Summary

Instruction

Nice! SQL makes it also extremely easy to sort rows. Take a look:

SELECT *
FROM employee
ORDER BY department;

In the query above, we select all the information from the employee table and sort the rows by the department using a ORDER BY clause. In SQL, rows are sorted in the ascending order by default.

Exercise

The German couple found a nice hotel thanks to our help. Now, they are beginning to think about another trip... let's help them pick something nice!

Show the name and city of all hotels. Sort the rows by the city name.

Stuck? Here's a hint!

Type:

SELECT name, city
FROM hotel
ORDER BY city;