首页 > 数据库技术 > 详细

Oracle作业错题集

时间:2015-08-18 21:11:52      阅读:299      评论:0      收藏:0      [点我收藏+]

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作业错题集

原文:http://www.cnblogs.com/wuchao18395441006/p/4740468.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!