Oracle Window Functions
14 functions
ROW_NUMBERROW_NUMBER() OVER (w)Assigns a unique sequential integer to each row within a partition.
RANKRANK() OVER (w)Assigns the same rank to equal values, with gaps in ranking.
DENSE_RANKDENSE_RANK() OVER (w)Assigns the same rank to equal values, without gaps in ranking.
PERCENT_RANKPERCENT_RANK() OVER (w)Returns the relative rank as a value between 0 and 1.
CUME_DISTCUME_DIST() OVER (w)Returns the cumulative distribution value.
NTILENTILE(n) OVER (w)Divides the partition into n equal buckets.
LAGLAG(expr [, n [, default]]) OVER (w)Returns the value from n rows before the current row.
LEADLEAD(expr [, n [, default]]) OVER (w)Returns the value from n rows after the current row.
FIRST_VALUEFIRST_VALUE(expr) OVER (w)Returns the first value in the window frame.
LAST_VALUELAST_VALUE(expr) OVER (w)Returns the last value in the window frame.
NTH_VALUENTH_VALUE(expr, n) OVER (w)Returns the nth value in the window frame.
RATIO_TO_REPORTRATIO_TO_REPORT(expr) OVER (w)Returns the ratio of the current value to the sum.
FIRSTagg_fn() KEEP (DENSE_RANK FIRST ORDER BY ...)Applies an aggregate function to the first group in the sorted order.
LASTagg_fn() KEEP (DENSE_RANK LAST ORDER BY ...)Applies an aggregate function to the last group in the sorted order.
