Select*fromstudentorderbyname;+--------+--------+--------+|Name | RollNo|Grade |+--------+--------+--------+|Aarav |150&nbs"/> Select*fromstudentorderbyname;+--------+--------+--------+|Name | RollNo|Grade |+--------+--------+--------+|Aarav |150&nbs">

Home  >  Article  >  Database  >  What is the default sort order in MySQL tables?

What is the default sort order in MySQL tables?

PHPz
PHPzforward
2023-09-17 17:45:092720browse

MySQL 表中的默认排序顺序是什么?

#The default sort order in MySQL tables is ascending. Whenever we use ORDER BY clause to sort the rows in a table, MySQL gives the output in ascending order, with the smallest value first. Consider the following example from a table named "student" -

mysql> Select * from student order by name;
+--------+--------+--------+
| Name   | RollNo | Grade  |
+--------+--------+--------+
| Aarav  | 150    | M.SC   |
| Aryan  | 165    | M.tech |
| Gaurav | 100    | B.tech |
+--------+--------+--------+
3 rows in set (0.00 sec)

We can see that the above query gives the output, sorted by name, in ascending order, starting from the minimum value of the "Name" column.

The above is the detailed content of What is the default sort order in MySQL tables?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete