An aggregate function that
returns the minimum value used within a specified column.
Synopsis
MIN([ALL | DISTINCT] column-name)
The MIN aggregate function gets its value from the values of a specified
field in the multiple rows returned by a query.
MIN can be used in a
SELECT query
or subquery, and is commonly used in a HAVING clause. MIN can appear in a
SELECT list or HAVING clause alongside ordinary field values.
MIN cannot be used in a WHERE clause, a FROM clause, or an ORDER BY
clause. MIN is not supported in views.
By default, aggregate functions use Logical (internal) data values,
rather than Display values.
The specified field used by MIN should be a numeric field. Because no
type checking is performed, it is possible (though rarely meaningful) to invoke
it for non-numeric fields. Empty String ("") values are treated as zero (0)
in numeric fields, and as $c(0) in non-numeric fields. Validation checking
should prevent empty string values in numeric fields.
NULL values in data fields are ignored when deriving a MIN aggregate
function value. If no rows are returned by the query, or the data field value
for all rows returned is NULL, MIN returns NULL.
This query returns the minimum salary of employees in the Sales department:
SELECT MIN(salary)
FROM employee
WHERE department = "SALES"