mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
24 lines
425 B
Markdown
24 lines
425 B
Markdown
---
|
|
slug: /en/sql-reference/aggregate-functions/reference/min
|
|
sidebar_position: 2
|
|
title: min
|
|
---
|
|
|
|
Aggregate function that calculates the minimum across a group of values.
|
|
|
|
Example:
|
|
|
|
```
|
|
SELECT min(salary) FROM employees;
|
|
```
|
|
|
|
```
|
|
SELECT department, min(salary) FROM employees GROUP BY department;
|
|
```
|
|
|
|
If you need non-aggregate function to choose a minimum of two values, see `least`:
|
|
|
|
```
|
|
SELECT least(a, b) FROM table;
|
|
```
|