SQLite min(x,y,...) Function

The SQLite min(x,y,...) function returns the smallest value in the parameter list. If you want to find the largest value in a list, use the max() function.

Syntax

Here is the syntax of the SQLite min(x,y,...) function:

min(x, y, ...)

Note that the min(x) function with one parameter is an aggregate function .

Parameters

x, y, ...

Required. Argument list for comparison. All parameters are involved in the comparison. Parameters can be any data type, or expressions.

Return value

The SQLite min(x,y,...) function returns the smallest value in the parameter list.

The min(x,y,...) function will return NULL if any argument is NULL.

Examples

You can use the SQLite min(x,y,...) function to find the minimum value from some numbers:

SELECT min(2, 1, 5);
min(2, 1, 5) = 1

You can use the SQLite min(x,y,...) function to find the minimum value from some strings:

SELECT min('a', 'b', 'c');
min('a', 'b', 'c') = a

Here, the character a is returned from min('a', 'b', 'c') because it has the smallest ASCII value.