SQL - ORDER BY Keyword

A, ORDER BY keyword usage

ORDER BY keywords are used to sort data, the ASC default (ascending), can DESC keyword to descending.

ORDER BY keyword syntax: 

SELECT * from table WHERE conditional statement 1 ORDER BY column names, column names 2 ... ASC \ DESC;

Student demo table:

Query data name = 'Bob' and press class_id descending order, for example:

SELECT * from student WHERE name = '小明' ORDER BY class_id DESC;

operation result:

Guess you like

Origin www.cnblogs.com/mingmingming/p/11298087.html