Oracle "Partition By" Keyword

Posted by Nalandial on Stack Overflow See other posts from Stack Overflow or by Nalandial
Published on 2009-02-18T16:31:10Z Indexed on 2010/03/29 18:13 UTC
Read the original article Hit count: 375

Filed under:
|

Can someone please explain what the "partition by" keyword does and give a simple example of it in action, as well as why one would want to use it? I have a SQL query written by someone else and I'm trying to figure out what it does.

An example of partition by:

SELECT empno, deptno, COUNT(*) 
OVER (PARTITION BY deptno) DEPT_COUNT
FROM emp

The examples I've seen online seem a bit too in-depth.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about plsql