SQL Knowledge Center · About ·
Easy Interactive Online SQL Training for Beginners

SQL ORDER BY Tutorial - Interactive Database Lesson

Lesson 10 of 31

ORDER BY

Interactive SQL Tutorial

If you want to sort the rows by some kind of attribute, you can use the ORDER BY keyword. For example, if you want to sort the friends_of_pickles by name, you would run: SELECT * FROM friends_of_pickles ORDER BY name;. That returns the names in ascending alphabetical order.

In order to put the names in descending order, you would add a DESC at the end of the query.

Can you run a query that sorts the friends_of_pickles by height_cm in descending order?

SQL:

Query Result:

Available Tables: