MySQL LEAST() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL LEAST() Function

❮ MySQL Functions

Example

Return the smallest value in a list of expressions:

SELECT LEAST(3, 12, 34, 8, 25);
Try it Yourself »

Definition and Usage

The LEAST() function returns the smallest value in a list of expressions.

Note: See also the GREATEST() function.

Syntax

LEAST(expr1, expr2, expr3, ...)

Parameter Values

Parameter Description
expr1, expr2, expr3, ... Required. The expression list to be evaluated

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Return the smallest value in a list of expressions:

SELECT LEAST("w3Schools.com", "microsoft.com", "apple.com");
Try it Yourself »

❮ MySQL Functions