5.18 Analytical Capabilities of SQL Plus
ORACLE includes enhancements to SQL called analytic functions that allow it
to produce quite refined reports. These features reduce the need to use external
reporting tools and simplify statistical data analysis.
Analytical functions compute a value for each row of a query. These values
are, in turn, based on a set of rows that is computed for each row and may be
considered to appear in a sliding window. This set of rows is known as a window
and it is specified by the analytical clause, which is the parenthesizd expression
that follows the reserved word over.
An example of the use of an analytic function (which we discuss in detail
in Example 5.18.2) is the following query that computes a list of students, the
number of courses they took, and their grade point average.
select STUDENTS.name, GA.noc as no_of_c, GA.gpa as gpa,
rank() over (partition by GA.noc
order by GA.gpa desc) as rank
from (select stno,