by Francis_hao Dec 17,2016
Sort data Record Query
Sorting refers to the orderly emission of filtered data that meets the criteria, in ascending (ASC (default)) and descending (DESC) mode.
mysql> Select Field1 field2 ... from table_name [where condition ] ORDER by FIELDM1 [Asc|desc],fieldm2 asc| Desc,......;
The second sort field here is sorted in the same situation as the first sort field. If the first sort field does not have the same item, the second sort field has no effect.
Restricting Data logging queries
If the query gets too much data, you can limit the number of displays.
mysql> Select Field1 field2 ... from table_name [where condition ] limit [ start position ,] Number of c6> ;
Where the starting position can be omitted, the default is 0, that is, the first data.
Starting with the first data, only two data is displayed.
This article was authored by Liu Yinghao and licensed under the Creative Commons Attribution-NonCommercial use-Share 3.0 Chinese mainland license agreement in the same way. Welcome reprint, please specify the source:
Reprinted from: http://www.cnblogs.com/yinghao1991/p/6193089.html
Reference
[1] Wang Feifei Triyang He Yaju "MySQL database application from getting started to mastering (second edition)" Beijing: China Railway Press, September 2014
MySQL using notes (vii) Sorting and restricting data logging queries