Export (0) Print
Expand All

MIN

SQL Server 2000

Returns the minimum value in the expression.

Syntax
MIN ( [ ALL ] expression ) 
Arguments
ALL
Applies the aggregate function to all values. ALL is the default.
expression
Is a constant, column name, or function, and any combination of arithmetic, bitwise, and string operators. MIN can be used with numeric, nchar, nvarchar, or datetime columns but not with bit columns. Aggregate functions and subqueries are not permitted.
Return Types

Returns a value of the same type 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 uses MIN to determine the lowest priced item in the Products table in the Northwind database.

SELECT MIN(UnitPrice) AS "Least Expensive" FROM Products

This is the result set:

Least Expensive
---------------
2.5

Show:
© 2015 Microsoft