> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/window/max-window",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for MAX function

# MAX OVER

Returns the maximum value within the requested window.

For more information on usage, please refer to [Window Functions](/reference-sql/functions-reference/window).

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
MAX( <expression> ) OVER ( [ PARTITION BY <partition_by> ] )
```

## Parameters

| Parameter        | Description                                       | Supported input types |
| :--------------- | :------------------------------------------------ | :-------------------- |
| `<expression>`   | A value used for the `MAX` function               | Any                   |
| `<partition_by>` | An expression used for the `PARTITION BY` clause. | Any                   |

## Return Types

Same as input type

## Example

The example below queries test scores for players in various grade levels. Unlike a regular `MAX()` aggregation, the window function highlights how each player individually compares to the highest game score for their level.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT
	nickname,
	level,
	current_score,
	MAX(current_score) OVER (PARTITION BY level) AS highest_score
FROM
	players;
```

**Returns**:

| nickname    | level | current\_score | highest\_score |
| :---------- | :---- | :------------- | :------------- |
| kennethpark | 9     | 76             | 95             |
| sabrina21   | 7     | 90             | 98             |
| burchdenise | 5     | 79             | 99             |
| ymatthews   | 6     | 85             | 93             |
| rileyjon    | 8     | 80             | 84             |
