Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Oracle "over" Analytic Function tips

Oracle Tips by Laurent Schneider

 

Laurent Schneider is considered one of the top Oracle SQL experts, and he is the author of the book "Advanced Oracle SQL Programming" by Rampant TechPress.  The following is an excerpt from the book.

Analytics

An analytic function is calculated over multiple rows and returns the result in the current row. The multiple row function could be an aggregate function, like COUNT, or a pure analytic function like RANK.

OVER

The scope of an analytic function is defined in an OVER clause. OVER is a mandatory keyword for all analytic functions. Giving () as the parameter to OVER indicates the widest possible scope - ?all?. In the example below, the total number of departments over the whole table is counted.

SELECT
   DEPTNO,
   COUNT(*) OVER () "NUMBER OF DEPARTMENTS"
FROM
   DEPT;

    DEPTNO COUNT(*)OVER()
---------- --------------
        10              4
        20              4
        30              4
        40              4

The total count of departments is returned next to each department. Note the COUNT function is used here without the GROUP BY clause.

It is possible to use the KEEP clause to retrieve additional columns.

SELECT
   ENAME,
   SAL,
   MIN(ENAME) KEEP (DENSE_RANK FIRST ORDER BY SAL) OVER (),
   MIN(SAL) OVER ()
FROM
   EMP;

ENAME             SAL MIN(ENAME) MIN(SAL)OVER()
---------- ---------- ---------- --------------
SMITH             800 SMITH                 800
ALLEN            1600 SMITH                 800
WARD             1250 SMITH                 800
JONES            2975 SMITH                 800
MARTIN           1250 SMITH                 800
BLAKE            2850 SMITH                 800
CLARK            2450 SMITH                 800
SCOTT            3000 SMITH                 800
KING             5000 SMITH                 800
TURNER           1500 SMITH                 800
ADAMS            1100 SMITH                 800
JAMES             950 SMITH                 800
FORD             3000 SMITH                 800
MILLER           1300 SMITH                 800

The name and salary of the employee with the lowest salary is returned.

 


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.