Learn to use the ORDER BY function in SQL to sort data with our tutorial and screenshots.
ORDER BY
-
The ORDER BY keyword is used to sort data in our table.
-
ORDER BY sorts data based on a specific column(s) in either ascending or descending order.
-
Syntax: SELECT * FROM table ORDER BY column_1 DESC ;
Example
Let’s say we have a basketball league and we keep records of each player, which team they are on, and their basic statistics.

If we wanted to use a SQL query to find the top rebounders, we would write the following:

Once we hit enter and run, our result should be as follows:
