当前位置:Gxlcms > 数据库问题 > Oracle数据库--排序

Oracle数据库--排序

时间:2021-07-01 10:21:17 帮助过:17人阅读

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   --   表示   

人气教程排行