ORACLE GROUPING_ID函数
可以使用GROUPING_ID函数借助HAVING子句对记录进行过滤,将不包含小计或者总计的记录除去。GROUPING_ID()函数可以接受一列或多列,返回GROUPING位向量的十进制值。GROUPING位向量的计算方法是将按照顺序对每一列调用GROUPING函数的结果组合起来。
关于GROUPING函数的使用方法可以参见我前面写的一篇文章
http://blog.csdn.net/wh62592855/archive/2009/11/16/4818072.aspx
1、GROUPING_ID用法实例
SQL> select
2 division_id,job_id,
3 grouping(division_id) as div_grp,
4 grouping(job_id) as job_grp,
5 grouping_id(division_id,job_id) as grp_id,
6 sum(salary)
7 from employees2
8 group by cube(division_id,job_id)
9 order by division_id,job_id;
DIV JOB DIV_GRP JOB_GRP GRP_ID SUM(SALARY)
--- --- ---------- ---------- ---------- -----------
BUS MGR 0 0 0 530000
BUS PRE 0 0 0 800000
BUS WOR 0 0 0 280000
BUS 0 1 1 1610000
OPE ENG 0 0 0 245000
OPE MGR &nbs
相关文档:
找到一个介绍oracle版本的文章。
http://wapedia.mobi/en/Oracle_Database#3.
■1979: Larry Ellison and friends founded Software Development Laboratories.
■1979: SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced its product Oracle V2 as an early commercially ......
2.根据Oracle 数据库scott 模式下的emp 表和dept 表,完成下列操作:
(1) 查询20号部门的所有员工信息;
(2) 查询所有工种为CLERK 的员工的员工号、员工名和部门号;
(3) 查询奖金COMM 高于工资SAL 的员工信息;
  ......
介绍一下内联、左联、右联
一.先看一些最简单的例子
例子
Table A
aid adate
1 a1
2 a2
3 a3
TableB
bid bdate
1 b1
2 b2
4 b4
两个表a,b相连接,要取出id相同的字段
select * from a inner join b on a.aid = b.bid这是仅取出匹配的数据.
此时的取出的是:
1 a1 b1
2 a2 b2
那么left join 指:
select * ......