# Window Functions

- [Window Functions Overview](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-overview.md): Understand window function concepts. These functions operate on a set of rows (window) defined by an OVER clause, returning a value for each row without collapsing results.
- [Window Frames](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-frames.md): Define subsets of rows for calculation. Window frames specify which rows relative to the current row are included in the window function's calculation.
- [ColumnStore Window Functions](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/window-functions-columnstore-window-functions.md): Review window function support in ColumnStore. This page details the specific window functions and limitations applicable when using the ColumnStore storage engine.
- [CUME\_DIST](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/cume_dist.md): Calculate cumulative distribution. This function returns the relative rank of the current row within its partition, calculated as the percentage of rows preceding or peer to it.
- [DENSE\_RANK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/dense_rank.md): Calculate rank without gaps. This function assigns a rank to each row within a partition, with tied values receiving the same rank and no numbers skipped.
- [FIRST\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/first_value.md): Return the value from the first row in the window frame. This function retrieves the value of an expression from the first row of the defined window.
- [LAG](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lag.md): Access data from a preceding row. This function returns the value of an expression from a row at a specified physical offset prior to the current row.
- [LEAD](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/lead.md): Access data from a following row. This function returns the value of an expression from a row at a specified physical offset after the current row.
- [MEDIAN](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/median.md): Calculate the median value. This window function returns the middle value (50th percentile) of an ordered set of values within the window.
- [NTH\_VALUE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/nth_value.md): Return the value from the N-th row. This function retrieves the value of an expression from the N-th row within the window frame.
- [NTILE](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/ntile.md): Distribute rows into buckets. This function divides the rows in an ordered partition into a specified number of approximately equal groups.
- [PERCENT\_RANK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percent_rank.md): Calculate relative rank. This function returns the percentage rank of the current row within its partition, ranging from 0 to 1.
- [PERCENTILE\_CONT](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_cont.md): Calculate a continuous percentile. This inverse distribution function returns an interpolated value that corresponds to the specified percentile.
- [PERCENTILE\_DISC](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/percentile_disc.md): Calculate a discrete percentile. This inverse distribution function returns an actual value from the dataset that corresponds to the specified percentile.
- [RANK](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/rank.md): Calculate rank with gaps. This function assigns a rank to each row, with tied values receiving the same rank and subsequent ranks skipped.
- [ROW\_NUMBER](https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions/row_number.md): Complete ROW\_NUMBER() reference: ROW\_NUMBER() OVER() window syntax, PARTITION BY clauses, ORDER BY ordering, and RANK()/DENSE\_RANK() comparisons.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/special-functions/window-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
