min aggregate function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns the minimum value of expr in a group.

Syntax

min(expr) [FILTER ( WHERE cond ) ]

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.

Examples

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