SQL Flow Field Guide

MIN

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

aggregation

What changes

Input
the argument expression over each group's rows (COUNT(*) reads no column)
Output or change
one value per group (or one for the whole input when there is no GROUP BY)
Return type
Returns a value same as expression.

Syntax at a glance

MIN ( [ ALL | DISTINCT ] expression )

Work example

Find the earliest date or lowest value inside a group.

Check whether nulls should be excluded and whether text comparison follows the chosen collation.

Check your work MIN returns the smallest nonnull value under the type's ordering rules.

Practice SQL

Open in SQL Flow
SELECT MIN(n) AS smallest FROM (VALUES (8), (3), (5)) AS v(n);

Open Microsoft Learn for full syntax, permissions, and details for your version.