oracle 複習之排序操作

   對查詢的將結果進行排序,默認是按照升序排列

order by +字段

order by 寫在所有子句的最後

排序有兩種:①升序ASC(默認排序方式可以不寫)②降序DESC

select * from emp order by sal;

等價於:

select * from emp order by sal  asc;

 

降序:

select * from emp order by sal desc;

如果要進行多個字段的排序,可以使用逗號隔開在每個字段後邊加上排序的方式。 

select *  from  emp order by sal asc,hiredate desc;

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章