Home  >  Article  >  Database  >  Oracle PL/SQL之GROUP BY ROLLUP

Oracle PL/SQL之GROUP BY ROLLUP

WBOY
WBOYOriginal
2016-06-07 16:46:091327browse

ROLLUP字面意思大概就是向上卷,用在GROUP BY 里面可起到累积求和的作用: 没有ROLLUP的情况下,以下查询按department_id和job_

ROLLUP字面意思大概就是向上卷,用在GROUP BY 里面可起到累积求和的作用: 

没有ROLLUP的情况下,以下查询按department_id和job_id进行分组求和:

Output:

有ROLLUP的情况下:

先对department_id和job_id进行分组求和,,再根据department_id累计求和,最后计算总和:

Output:

先对department_id和job_id进行分组求和,再根据job_id累计求和,最后计算总和:

Output:

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn