美文网首页
多行函数

多行函数

作者: 52Hz的蓝鲸 | 来源:发表于2017-01-10 23:20 被阅读0次

    1、定义于一组数据,并返回结果

    avg函数 

    sum函数

    count函数 

    2、having过滤分组

    having 和 where 最大的区别是 where条件后不能用主函数,where的效率高

    having是先分组后过滤,where是先过滤后分组

    3、group by 语句的增强

    select deptno,job,sum(sal) from emp group by deptno,job

    +select deptno,sum(sal) from emp group by deptno;

    +select sum(sal)  from emp

    =select deptno,job,sum(sal) from emp group by rollup(deptno,job)

    所以:group by rollup(a,b)=group by a,b+group by a+group by null

    break on deptno skip 2---设置相同的部门号只显示一次,不同的部门号跳过两行

    break on null---取消设置

    相关文章

      网友评论

          本文标题:多行函数

          本文链接:https://www.haomeiwen.com/subject/pyulbttx.html