- MySQL 8 for Big Data
- Shabbir Challawala Jaydip Lakhatariya Chintan Mehta Kandarp Patel
- 138字
- 2021-08-20 10:06:13
ORDER BY clause
The ORDER BY helps us in retrieving records in an ordered manner. This provides sorted data on a particular column in an ascending or a descending manner. By default, it will sort in ascending order but we can also explicitly specify the sorting manner with ASC and DESC keyword. If we specify ASC then it will sort in an ascending order while DESC keyword will sort in descending order. Here is the query which will find all users in a sorted manner in an ascending order on city column.
SELECT * FROM users ORDER BY city ASC;
Sorting in multiple columns is also possible using ORDER BY clause. We can pass multiple columns as shown in below query where we have ordered by city and username column.
SELECT * FROM users ORDER BY city, username;
推薦閱讀
- Python科學計算(第2版)
- Node.js Design Patterns
- SQL Server 2012數據庫技術及應用(微課版·第5版)
- 精通搜索分析
- jQuery從入門到精通 (軟件開發視頻大講堂)
- Scratch 3游戲與人工智能編程完全自學教程
- QTP自動化測試進階
- Python完全自學教程
- Mastering JavaScript Design Patterns(Second Edition)
- SQL Server從入門到精通(第3版)
- Visual C#通用范例開發金典
- Spring Boot+Vue全棧開發實戰
- 從Power BI到Analysis Services:企業級數據分析實戰
- Learning Ionic(Second Edition)
- 計算思維與Python編程