<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide > Basic Building Blocks > Functions > Aggregate Functions >


Previous pageReturn to chapter overviewNext page

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


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.