Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

MIN function

Focus mode
MIN function - Amazon Redshift

The MIN function returns the minimum value in a set of rows. DISTINCT or ALL might be used but do not affect the result.

Syntax

MIN ( [ DISTINCT | ALL ] expression )

Arguments

expression

The target column or expression that the function operates on. The expression is one of the following data types:

  • SMALLINT

  • INTEGER

  • BIGINT

  • DECIMAL

  • REAL

  • DOUBLE PRECISON

  • CHAR

  • VARCHAR

  • DATE

  • TIMESTAMP

  • TIMESTAMPTZ

  • TIME

  • TIMETZ

  • VARBYTE

  • SUPER

DISTINCT | ALL

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

Data types

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

Examples

Find the lowest price paid from all sales:

select min(pricepaid) from sales; min ------- 20.00 (1 row)

Find the lowest price paid per ticket from all sales:

select min(pricepaid/qtysold)as min_ticket_price from sales; min_ticket_price ------------------ 20.00000000 (1 row)

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.