sql 练习(2)
摘要:
1.用Decode函数实现横表和竖表的转换1 SELECT deptno DEPARTMENT_ID,2 COUNT(*) "部门人数",3 SUM(DECODE(SIGN(sal-9000),-1,0,1)) "超高收入人数(>9000)",4 SUM(DECODE(SIGN(sal-9000),-1,0,( DECODE(SIGN(sal-12000),1,0,1) ) )) "极高收入人数([9000,12000])",5 SUM(DECODE(SIGN(sal-6000),-1,0,( DECODE(SIGN(sal-9 阅读全文
posted @ 2013-09-03 11:44 a_badegg 阅读(405) 评论(1) 推荐(0) 编辑