| In Oracle : Partition by in Oracle | |||
|
|
|||
| |||
|
|
|||
|
In-Oracle.com -> Oracle SQL & PLSQL -> Partition by in Oracle
Partition by in Oracle
NOTE: I named "group by" column a column based on a function like SUM, COUNT, AVG, MAX, MIN (demands a "group by" clause in the SELECT statement ).
This can be done with the over() option:
Exemples:
select max(comm) over() as max_comm, empno, ename, comm from emp;
select empno, ename, max(sal) over() as max_sal, sal from emp;
SQL> select max(comm) from emp;
SQL> select max(comm) over() as max_comm, empno,
ename, comm from emp;
You can also calculate a MAX per group:
select empno, ename, job, max(sal) over(partition by job ) as max_sal, sal from emp;
EMPNO
ENAME JOB
MAX_SAL SAL
In-Oracle.com -> Oracle SQL & PLSQL -> Partition by in Oracle |
||
|
|||
|
|
Find related information on Google:
Custom Search
|
Copyright (c) 2011-2012 www.in-oracle.com | Disclaimer: The views expressed on this web site are my own and do not reflect the views of Oracle Corporation. You may use the information from this site only at your risk.