Window Functions
Window function syntax is required with analytical functions and can also be used with aggregate functions.
A window function is defined "over" a group of rows (a window) from a query. A window function produces a result value for each input row, where the value is computed according to the records in the current window.
A window is defined with an optional partitioning definition and an ordering definition.
• The partitioning defines sets of rows over which the function results are computed. Partitioning is like the grouping of a grouped query. Without the partitioning definition, the function will operate over the entire set of records returned by the query.
• The ordering defines the order of rows within a partition, which determines the function values.
Note: The ordering does not define the order of result rows from the query. If the results of a query need to be sorted, a separate ORDER BY clause is required on the result set.