Name

min() — Return the argument with the smallest value

Common Usage

min( param1, param2, ... )

Description

Given two or more parameters, the min() function will return the parameter with the smallest value. If any parameter is a NULL, a NULL will be returned. Otherwise, numeric types (mixed integers and floating-point) are considered smallest, sorted together in their natural order. These are followed by text values, which are followed by BLOB values.

If you want the comparison to use a specific collation, use a COLLATE expression to attach an explicit collation to the input values. For example, min( param1 COLLATE NOCASE, param2 ).

There is also an aggregate version of min() that takes a single parameter.

See Also

max(), min(), COLLATE [SQL Expr, Ap D]

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.