- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I change the default sort order of MySQL tables?
As we know that when we use ORDER BY Clause, the default sort order of MySQL table is ascending, start with the smallest value. We can change this default order by using DESC keyword along with ORDER BY Clause. The following example will clarify this concept −
>mysql> Select * from STUDENT ORDER BY Name DESC; +--------+--------+--------+ | Name | RollNo | Grade | +--------+--------+--------+ | Gaurav | 100 | B.tech | | Aryan | 165 | M.tech | | Aarav | 150 | M.SC | +--------+--------+--------+ 3 rows in set (0.00 sec)
We can see that after using the keyword DESC the default order has been changed from ascending to descending.
- Related Articles
- What is the default sort order in MySQL tables?
- How can I merge two MySQL tables?
- How can I see the description of a MySQL Temporary Tables?
- How can we change the default MySQL database to the given database?
- How can we sort MySQL output in descending order?
- How can we sort MySQL output in ascending order?
- How to get the list of tables in default MySQL database?
- How can I the date of creation and updation of tables in MySQL?
- How Can I check the size of the tables in a particular MySQL database?
- How can I sum columns across multiple tables in MySQL?
- How can I change the storage engine of a MySQL table?
- How to change the default charset of a MySQL table?
- How can I get the output of multiple MySQL tables from a single query?
- How can we see MySQL temporary tables in the list of tables?
- How can I change root username in MySQL?

Advertisements