zoukankan      html  css  js  c++  java
  • 数据库练习

    select
    dept.dname,
    ano "1000以下",
    bno "1000~2000",
    cno "2000~3000",
    dno "3000以上"
    from dept,
    (select ano,bno,cno,nvl(d."3000以上",0) dno,g.deptno from
    (select ano,bno,nvl(c."2000~3000",0) cno,f.deptno from
    (select ano,nvl(b."1000~2000",0) bno,e.deptno from
    (select nvl(a."1000以下",0) ano ,dept.deptno from dept
    full join
    (select count(sal) "1000以下" , deptno from emp where sal<1000 group by deptno) a
    on dept.deptno = a.deptno) e
    full join
    (select count(ename) "1000~2000",deptno from emp where sal>=1000 and sal<2000 group by deptno) b
    on e.deptno = b.deptno) f
    full join
    (select count(ename) "2000~3000",deptno from emp where sal>=2000 and sal<=3000 group by deptno) c
    on f.deptno = c.deptno) g
    full join
    (select count(ename) "3000以上",deptno from emp where sal>3000group by deptno) d
    on g.deptno = d.deptno) h
    where dept.deptno = h.deptno;

    输出结果:

  • 相关阅读:
    钟国晨160809323(作业5)
    12
    11
    第九次
    8作业
    第七次作业
    6
    林昊5
    计算机网络原理与应用笔记 3/29
    计算机网络原理与应用笔记 3/22
  • 原文地址:https://www.cnblogs.com/baichaofeng123/p/7229690.html
Copyright © 2011-2022 走看看