MIN (Transact-SQL)
Returns the minimum value in the expression. May be followed by the OVER clause.
Syntax
MIN ( [ ALL | DISTINCT ] expression )
Arguments
ALL
Applies the aggregate function to all values. ALL is the default.DISTINCT
Specifies that each unique value is considered. DISTINCT is not meaningful with MIN and is available for ISO compatibility only.expression
Is a constant, column name, or function, and any combination of arithmetic, bitwise, and string operators. MIN can be used with numeric, char, varchar, or datetime columns, but not with bit columns. Aggregate functions and subqueries are not permitted.For more information, see Expressions (Transact-SQL).
Return Types
Returns a value same as expression.
Remarks
MIN ignores any null values.
With character data columns, MIN finds the value that is lowest in the sort sequence.
Examples
The following example returns the lowest (minimum) tax rate.
USE AdventureWorks;
GO
SELECT MIN(TaxRate)
FROM Sales.SalesTaxRate;
GO
Here is the result set.
-------------------
5.00
(1 row(s) affected)