본문 바로가기

Sorting with ORDER BY

English
Sorting the result

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

SELECT name, score FROM student ORDER BY score DESC;
  • ASC sorts ascending (smallest first) — this is the default.
  • DESC sorts descending (largest first).

ORDER BY score DESC lists Sara 95, Mei 88, Lin 88, Jamal 72, Tom 64; Mei and Lin tie

교재 자료

로그인 또는 계정 만들기

IGCSE, A-Level & AP