order

UK[ˈɔ:də(r)] US[ˈɔ:rdə(r)]

n. Order; command; sequence; rule, System

vt. Order; order; organize

vi. Place an order

Third person singular: orders Plural: orders Present participle: ordering Past tense: ordered Past participle: ordered

by

英[baɪ] 美[baɪ]

prep.beside...;expression;because;through

adv. pass; used when expressing retention or preservation; short visit

mysql ORDER BY statement syntax

Function: Used to sort the result set.

Syntax: Order: SELECT * from table name ORDER BY sorted field name Reverse order: SELECT * from table name ORDER BY sorted field name DESC

Description: The ORDER BY statement is used to sort the result set based on the specified column. The ORDER BY statement sorts records in ascending order by default. If you want to sort records in descending order, you can use the DESC keyword.

mysql ORDER BY statement example

//以字母顺序显示公司名称
SELECT Company, OrderNumber FROM Orders ORDER BY Company;
//以字母顺序显示公司名称(Company),并以数字顺序显示顺序号(OrderNumber)
SELECT Company, OrderNumber FROM Orders ORDER BY Company, OrderNumber;
//以逆字母顺序显示公司名称
SELECT Company, OrderNumber FROM Orders ORDER BY Company DESC;