top of page
CerebroSQL

MySQL: 

MIN

Syntax:
MIN([DISTINCT] expr) [over_clause]

Returns the minimum value of expr. MIN() may take a string argument; in
such cases, it returns the minimum string value. See
https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html. The
DISTINCT keyword can be used to find the minimum of the distinct values
of expr, however, this produces the same result as omitting DISTINCT.

If there are no matching rows, MIN() returns NULL.

This function executes as a window function if over_clause is present.
over_clause is as described in
https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html; it
cannot be used with DISTINCT.

URL: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html

Example

mysql> SELECT student_name, MIN(test_score), MAX(test_score)
FROM student
GROUP BY student_name;

bottom of page