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

What is the default sort order in MySQL tables?

PHPz
Release: 2023-09-17 17:45:09
forward
2792 people have browsed it

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template