In mysql, you can use the desc keyword to display the query results in descending order. This keyword is the abbreviation of descend. It is often used in conjunction with the order by clause to make the query results in descending order. The syntax is "select field 1, field 2... from table name order by specified field desc".
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Use the desc keyword
What does desc mean?
desc is the abbreviation of [describe v. describe] and [descend v. drop].
desc and asc in mysql:
select 字段1,字段2... from 表名 order by 指定字段 desc;
select 字段1,字段2... from 表名 order by 指定字段 asc;
select 字段1,字段2... from 表名 order by 指定字段1 asc, 指定字段2 desc;
The above is the detailed content of How to set descending order in mysql query. For more information, please follow other related articles on the PHP Chinese website!