排序检索数据
3.1排序数据
可以看到title的输出并没有特定的顺序
MariaDB [test]> SELECT title
-> From books;
title |
---|
The Fellowship of the Ring |
The Two Towers |
The Return of the King |
The Sum of All Men |
Brotherhood of the Wolf |
Wizardborn |
The Hobbit |
Lair of Bones |
8 rows in set (0.00 sec)
那么我们就需要用到ORDER BY语句
【waring】ORDER BY语句的位置
在制定一条ORDER BY 子句时应确保它是SELECT语句的最后一句,否则会报错
MariaDB [test]> SELECT title
-> From books
-> ORDER BY title;
title |
---|
Brotherhood of the Wolf |