Skip to main content
Returns the minimum value in its argument. NULL values are ignored. If all inputs are NULL, MIN returns NULL.

Syntax

MIN(<expression>) [FILTER ([WHERE] <condition>)]

Parameters

ParameterDescriptionSupported input types
<expression>The expression whose minimum to determineAny type
<condition>An optional boolean expression to filter rows used in aggregationBOOL

Return Types

Same as input type

Examples

The tournaments table contains the following data:
SELECT name, totalprizedollars FROM tournaments ORDER BY totalprizedollars LIMIT 5;
name text nulltotalprizedollars int null
The French Grand Prix237
The European Grand Prix465
The Desert Dash Rally643
The Turbocharged Championship Series704
The African Grand Prix895

Rows: 5Execution time: 6.00ms

The following example finds the smallest prize amount in the tournaments table:
SELECT MIN(totalprizedollars) AS minprize FROM tournaments;
minprize int null
237

Rows: 1Execution time: 5.74ms

MIN also works on text columns, returning the lexicographically smallest value. The following example finds the tournament name that comes first alphabetically:
SELECT MIN(name) AS mintournament FROM tournaments;
mintournament text null
The Acceleration Championship

Rows: 1Execution time: 6.22ms