MAX() OVER ...

All functions > WINDOW FUNCTION > MAX() OVER ...

Returns the maximum value in the window frame.

Syntax

Diagram(
  Sequence(
    Terminal("MAX"),
    Terminal("("),NonTerminal('expr'),Terminal(")"),
    Terminal("OVER"),
    Terminal("("),
    NonTerminal("over_clause"),
    Terminal(")"),
  )
)
ParameterTypeRequiredDescription
exprEXPRESSIONYesExpression to find maximum of
over_clauseOVER CLAUSEYesOVER (PARTITION BY ... ORDER BY ... [FRAME ...])

Notes

  • Finds maximum value over a window of rows
  • PARTITION BY divides rows into independent groups
  • ORDER BY determines row ordering within partitions
  • Window frame controls which rows are included in the calculation
  • Default frame is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
  • Useful for running maximums and comparisons
  • Returns same type as input expression
  • NULL values are ignored in the calculation
Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19