码迷,mamicode.com
首页 > 数据库 > 详细

Oracle数据库--排序

时间:2020-04-22 16:21:15      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:acl   chinese   test   select   asc   gif   oracl   --   表示   

1.排序有升序和降序之分:

  ASC表示升序排序,DESC表示降序排序.如果不指明排序顺序,默认的排序顺序为升序ASC.

2.以表中某些字段的加减乘除作为排序项:

  select name, (chinese + math) as score from zj_test order by score;

  技术图片

 3.decode()函数的使用 

  --通过decode()函数,sex值为男的记录被转换为了2,而其他的记录都是1
  select name, sex from zj_test order by decode (sex, ‘男‘, 2, 1);

  技术图片

 

Oracle数据库--排序

标签:acl   chinese   test   select   asc   gif   oracl   --   表示   

原文地址:https://www.cnblogs.com/yuehaikuo/p/12752519.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!