Skip to content

Sorting with ORDER BY · ⁨用 ORDER BY 排序⁩

English

Sorting the result

The rows come back in no particular order. Add ORDER BY to sort them by a column:

  • ASC sorts ascending (smallest first) — this is the default.
  • DESC sorts descending (largest first).
中文

给结果排序

返回的行没有固定顺序。加上 ORDER BY,按某一列把它们排序:

SELECT name, score FROM student ORDER BY score DESC;
  • ASC 表示升序(从小到大)—— 这是默认值。
  • DESC 表示降序(从大到小)。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩