• Order by排序


    1. asc 升序(默认),desc 降序
    2. order by 后面  可以加 列、表达式、别名、序号(从1开始)
      1 select empno,ename,sal,sal*12 from emp order by sal*12 desc;  --表达式
      2 select empno,ename,sal,sal*12 年薪 from emp order by 年薪 desc;  --别名 
      3 select empno,ename,sal,sal*12 年薪 from emp order by 4 desc;  --序号
      View Code
    3. order by会作用于后面所有列,先按照第一列进行排序,然后按照后一列,以此类推
    4. asc,desc会匹配最近的字段(由左至右)
      1 select * from emp order by deptno,sal                --优先按照deptno排序,若deptno相同则根据sal进行排序
      2 select * from emp order by deptno,sal desc         --deptno升序 sal降序排列 
      3 select * from emp order by deptno desc,sal desc  --降序排列
      View Code
    5. null值排序
      1. Oracle中null值最大,使用nulls last将含有null的的数据放到最后
        1 select * from emp order by comm desc nulls last;
        View Code
  • 相关阅读:
    UnityGUI Keynote
    Unity3D Asset 导入&导出
    Unity3d平台信息设置
    Unity3D自带Demo AngryBots路径
    如何判定Unity已破解成功
    fbx模型
    Init & Deinit & ARC
    Subscript & Inheritance
    Properties & Method
    Enumeration & Class & Structure
  • 原文地址:https://www.cnblogs.com/keenoooo/p/10062903.html
Copyright © 2020-2023  润新知