Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Your first table
Text data types
Summary

Instruction

That's right! One of the reasons for data types is that we can sort information quite easily. Let's check that.

SELECT
  *
FROM user_account 
ORDER BY nickname;

As you can see, we can sort the results of our SELECT statement by writing ORDER BY, followed by the name of the column (or several columns, separated with commas). The default order is ascending (that is, A comes before B). If you want to reverse the order, just put DESC after the column name(s):

SELECT
  *
FROM user_account 
ORDER BY nickname DESC;

Exercise

Peter started working on his database. He now has an impressive two columns in his table user_account: first_name and nickname.

Let's retrieve all the information from the table and sort it according to the values in the column first_name. Sort it in ascending order.