当前位置:Gxlcms > 数据库问题 > Oracle作业错题集

Oracle作业错题集

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

1.sccot.emp表中

查询公司的人数,以及在80,81,82,87年,每年雇用的人数,结果类似下面的格式 


    TOTAL        1980        1981        1982        1987
---------- ---------- ---------- ---------- ----------
          14              1           10              1             2

SQL> edit
已写入 file afiedt.buf

1 select count(*) total,sum(decode(to_char(hiredate,‘YYYY‘),1980,1,0))as "1980",
2 sum(decode(to_char(hiredate,‘YYYY‘),1981,1,0))as "1981",
3 sum(decode(to_char(hiredate,‘YYYY‘),1982,1,0))as "1982",
4 sum(decode(to_char(hiredate,‘YYYY‘),1987,1,0))as "1987"
5* from emp
SQL> /

    TOTAL        1980        1981        1982        1987
---------- ---------- ---------- ---------- ----------
          14              1           10              1             2

Oracle作业错题集

标签:

人气教程排行