> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 用于计算一组值中最小值的聚合函数。

# min

<div id="min">
  ## min
</div>

引入版本：v1.1.0

用于计算一组值中的最小值的聚合函数。

**语法**

```sql theme={null}
min(column)
```

**参数**

* `column` — 列名或表达式。[`Any`](/zh/reference/data-types)

**返回值**

返回分组中的最小值，返回类型与输入相同。[`Any`](/zh/reference/data-types)

**示例**

**简单的 min 示例**

```sql title=Query theme={null}
CREATE TABLE employees (name String, salary UInt32) ENGINE = Memory;
INSERT INTO employees VALUES ('Alice', 3000), ('Bob', 4000), ('Charlie', 3500);

SELECT min(salary) FROM employees;
```

```response title=Response theme={null}
┌─min(salary)─┐
│        3000 │
└─────────────┘
```

**结合 GROUP BY 的 Min**

```sql title=Query theme={null}
CREATE TABLE sales (department String, revenue UInt32) ENGINE = Memory;
INSERT INTO sales VALUES ('Engineering', 100000), ('Engineering', 120000), ('Marketing', 80000), ('Marketing', 90000);

SELECT department, min(revenue) FROM sales GROUP BY department ORDER BY department;
```

```response title=Response theme={null}
┌─department──┬─min(revenue)─┐
│ Engineering │       100000 │
│ Marketing   │        80000 │
└─────────────┴──────────────┘
```
