Returns the lowest value in a column.
is a column name, constant, function, any combination of column names, constants, and functions connected by arithmetic or bitwise operators, or a subquery. With aggregates, an expression is usually a column name. For more information, see “Expressions”.
select min(price) from titles where type = "psychology"
min, an aggregate function, finds the minimum value in a column.
For general information about aggregate functions, see “Aggregate functions”.
min can be used with numeric, character, and datetime columns. It cannot be used with bit columns. With character columns, min finds the lowest value in the sort sequence. min implicitly converts char datatypes to varchar, unichar datatypes to univarchar, stripping all trailing blanks. min ignores null values. distinct is not available, since it is not meaningful with min.
unichar data is collated according to the default Unicode sort order.
Adaptive Server goes directly to the first qualifying row for min when there is an index on the aggregated column, unless:
The expression is not a column
The column is not the first column of an index
There is another aggregate in the query
There is a group by clause
SQL92 – Compliance level: Transact-SQL extension.
Any user can execute min.
Commands compute clause, group by and having clauses, select, where clause
Functions avg, max