MySQL simple syntax (6)

Sort query results

  • Sort separate
  • 语法:SELECT *FROM table_name WHERE col_name ORDER BY [ASC]|DESC
  • Features: ASC ascending order (the default), DESC descending order
  • 例子:SELECT *FROM games
    WHERE GName=’p’
    ORDER BY GNO DESC

Multi-column sorting

- Grammar: the SELECT * the FROM the Table the WHERE col_name the ORDER BY col2_name ASC, col3_name DESC
- Features: multi-column sorting to be considered a priority issue, ORDER behind BY field priority order
- example: SELECT * FROM table1 ORDER BY tadt DESC, number ASC

Published 37 original articles · won praise 10 · views 10000 +

Guess you like

Origin blog.csdn.net/OneLinee/article/details/78756325
Recommended