JetSQL » Functions » MIN

Syntax:
SELECT MIN ( field ) AS [ expression ]
FROM table
[ WHERE criteria ]
[ GROUP BY grouping_expression ]
[ HAVING criteria ]
field
The name of the column where the minimum of the values is to be found.
expression
The name to be displayed for the resulting minimum value.
table
The name of the table the information is being retrieved from.
criteria
The condition(s) that dictate which rows are to be examined to determine the minimum value.
grouping_expression
An optional parameter that specifies a set of columns on which to group matching data.

The MIN function simply finds the lowest, or minimum, value in a field.

Examples

Code:
SELECT MIN(DaysInHospital) AS [MinStay]
FROM MediCarePatients
WHERE age > 65
Output:
MinStay
2

(1 row(s) affected)
Explanation:

This code finds the shortest hospital stay by a MediCare patient over the age of 65 and stores that information in 'MinStay'.

Language(s): MS SQL Server

See Also: