---
title: min aggregate function
description: Learn the syntax of the min function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/min
---

# `min` aggregate function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the minimum value of `expr` in a group.

## Syntax

```
min(expr) [FILTER ( WHERE cond ) ]
```

This function can also be invoked as a [window function](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-window-functions.md) using the `OVER` clause.

## Arguments

* `expr`: An expression of any type that can be ordered.
* `cond`: An optional boolean expression filtering the rows used for aggregation.

## Returns

The result type matches the type of the argument.

> [!NOTE]
>
> For certain `STRING` collations, such as `UTF8_LCASE`, the result may be non-deterministic.

## Examples

```sql
> SELECT min(col) FROM VALUES (10), (50), (20) AS tab(col);
 10

-- The result is non-deterministic due to collation
> SELECT min(col COLLATE UTF8_LCASE) FROM VALUES ('a', 'A') AS tab(col);
 a (or A)
```

## Related functions

* [`max` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/max.md)
* [`avg` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/avg.md)
* [`max_by` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/max_by.md)
* [`min_by` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/min_by.md)
* [`mean` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/mean.md)
