MIN
All functions > AGGREGATE > MIN
Returns the minimum value in the group.
Syntax
MIN(expr: T) → T
sql
Type Parameters:
T
: Any comparable type (numeric, string, date, timestamp, boolean)
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
expr | T | Yes | The expression to find the minimum value of |
num_values | ANY | No | Optional number of minimum values to return as array |
Returns
The minimum value, or array of bottom N values if num_values specified
Notes
- Returns the smallest value in the group
- Works with numeric, string, and date types
- NULL values are excluded from the calculation
- Returns NULL if all values are NULL or group is empty
- With num_values parameter, returns an array of the N smallest values
- Can be used with WHERE clause to filter before aggregation
- Can be used with GROUP BY clause for grouped aggregation