SQLite max(x,y,...) Function
The SQLite max(x,y,...)
function returns the largest value in the parameter list. If you want to find the smallest value in a list, use the min()
function.
Syntax
Here is the syntax of the SQLite max(x,y,...)
function:
max(x, y, ...)
Note that the max(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 max(x,y,...)
function returns the largest value in the parameter list.
The max(x,y,...)
function will return NULL
if any argument is NULL
.
Examples
You can use the SQLite max(x,y,...)
function to find the maximum value from some numbers:
SELECT max(2, 1, 5);
max(2, 1, 5) = 5
You can use the SQLite max(x,y,...)
function to find the maximum value from some strings:
SELECT max('a', 'b', 'c');
max('a', 'b', 'c') = c
Here, since the character c
has the largest ASCII value, so max('a', 'b', 'c')
returned c
.