2011年12月10日
摘要: Oracle Row Generator Techniqueshttp://www.club-oracle.com/forums/row-generation-method-in-sql-also-in-pl-sql-t129/http://www.orafaq.com/wiki/Oracle_Row_Generator_Techniques早期使用----- select rownum from all_objects where rownum <xxx现在可以使用-----select rownum from dual connect by rownum<xxx或者----se 阅读全文
posted @ 2011-12-10 21:37 Coldest Winter 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 1、group by的使用--根据DEPTNO和JOB进行分组。求相同DEPTNO,相同JOB的员工工资总和。SELECT E.DEPTNO,E.JOB,SUM(E.SAL) FROM EMP E GROUP BY E.DEPTNO,E.JOBORDER BY E.DEPTNO结果:2、group by 配合rollup的使用rollup()--可以使用一个或者多个参数。意思是从右向左进行数据的汇总统计,并生成一行,rollup是个统计函数。是根据分组情况进行统计,最终进行全部汇总。(1)、简单的使用rollup--生成一行新数据。(要生成新的一行数据,还可以使用UNION ALL)1 SEL 阅读全文
posted @ 2011-12-10 15:47 Coldest Winter 阅读(834) 评论(0) 推荐(0) 编辑