Select From table in Ascending Order

When you select rows from a table, you can select those based on the ascending and descending order of the values in a column.

In this MySQL Tutorial, we shall learn how to select rows of a table based on the ascending order of values in a column.

Syntax – Rows in Ascending Order

To sort rows of a result set in ascending order of values in a column, use the syntax of the following SQL Query.

</>
Copy
SELECT * FROM table_name ORDER BY column_name [ASC];

If you use ORDER BY column_name, by default, the rows are sorted in the ascending order of the column names. However you can mention ASC in the query.

The character set of the column is considered while sorting the column values in ascending order.

Example 1 – Sort Rows of Table in ASCENDING ORDER

Consider the following students table.

MySQL new column added

Now we shall sort these rows in ASCENDING ORDER of name column.

Run the following query to sort the records in ascending order.

</>
Copy
SELECT * FROM students ORDER BY name ASC;
MySQL SELECT FROM TABLE ORDER BY COLUMN ASCENDING ORDER