ClickHouse/docs/en/sql-reference/aggregate-functions/reference/min.md

24 lines
425 B
Markdown
Raw Normal View History

---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/aggregate-functions/reference/min
sidebar_position: 2
2022-08-28 21:34:50 +00:00
title: min
---
2021-04-28 01:37:06 +00:00
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;
```