ClickHouse/docs/en/sql-reference/aggregate-functions/reference/min.md
2024-06-24 14:32:52 +02:00

427 B

slug sidebar_position title
/en/sql-reference/aggregate-functions/reference/min 168 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;