Skip to main content
Version: V1.0.0

LEAST

Syntax

LEAST(value1, ...)

Description

Returns the minimum value of the parameters, which is the opposite of the GREATEST() function.

The parameters must be at least two. If any parameter is NULL, the return value is NULL.

If the parameters contain both numeric and character values, the character values are implicitly converted to numeric values. If the conversion fails, an error is returned.

Examples

SELECT LEAST(2, null), LEAST('2',4,9), LEAST('a','b','c'), LEAST('a',NULL,'c'), LEAST('2014-05-15','2014-06-01')\G
*************************** 1. row ***************************
LEAST(2, null): NULL
LEAST('2',4,9): 2
LEAST('a','b','c'): a
LEAST('a',NULL,'c'): NULL
LEAST('2014-05-15','2014-06-01'): 2014-05-15
1 row in set (0.001 sec)

SELECT LEAST(2);
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'LEAST'