Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

MAX Function

The MAX function returns the maximum value in a set of rows. DISTINCT or ALL may be used but do not affect the result.


MAX ( [ DISTINCT | ALL ] expression )



The target column or expression that the function operates on.


With the argument DISTINCT, the function eliminates all duplicate values from the specified expression before calculating the maximum. With the argument ALL, the function retains all duplicate values from the expression for calculating the maximum. ALL is the default.

Data Types

Accepts any data type except Boolean as input. Returns the same data type as expression. The Boolean equivalent of the MIN function is the BOOL_AND Function, and the Boolean equivalent of MAX is the BOOL_OR Function.


Find the highest price paid from all sales:

select max(pricepaid) from sales; max ---------- 12624.00 (1 row)

Find the highest price paid per ticket from all sales:

select max(pricepaid/qtysold) as max_ticket_price from sales; max_ticket_price ----------------- 2500.00000000 (1 row)