MAX

MAX ( [DISTINCT | ALL] < - value-expression> ) [ OVER < - window-specification> ]

<number-expression> can be any any numeric expression.

MAX returns the maximum value of all the value expressions evaluated for each row in the aggregation. When used without the OVER clause, MAX is considered an aggregate function. When used with the OVER clause, it is an analytic function.

For string values, MAX is determined by which string is last in the collating sequence.

When used as an analytic function, MAX will return null if the window being evaluated (or in the case of a PARTITION BY, the partition within the window matching the input row) contains no rows, as in the case of an offset window that contains no rows prior to CURRENT ROW. For more information on offset windows, see the topic WINDOW clause of the SELECT statement in this guide.