基本介紹
- 外文名:order by
- 用途:指定的列asdf對結果集進行排序
- 注意:from table_name後面
- 關鍵字:DESC 關鍵字
基本介紹
原始的表
Company | OrderNumber |
IBM | 3532 |
W3School | 2356 |
Apple | 4698 |
W3School | 6953 |
實例 1
SELECT Company,OrderNumber FROM Orders ORDER BY Company
Company | OrderNumber |
Apple | 4698 |
IBM | 3532 |
W3School | 6953 |
W3School | 2356 |
實例 2
SELECTCompany,OrderNumberFROMOrdersORDERBYCompany,OrderNumber結果:
Company | OrderNumber |
Apple | 4698 |
IBM | 3532 |
W3School | 2356 |
W3School | 6953 |
實例 3
SELECTCompany,OrderNumberFROMOrdersORDERBYCompanyDESC
Company | OrderNumber |
W3School | 6953 |
W3School | 2356 |
IBM | 3532 |
Apple | 4698 |
實例 4
SELECTCompany,OrderNumberFROMOrdersORDERBYCompanyDESC,OrderNumberASC
Company | OrderNumber |
W3School | 2356 |
W3School | 6953 |
IBM | 3532 |
Apple | 4698 |