Name

max() — Return the argument with the largest value

Common Usage

max( param1, param2, ... )

Description

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

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, max( param1 COLLATE NOCASE, param2 ).

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

See Also

min() [Agg SQL Func], max() [Agg SQL Func], 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.