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

> Вычисляет сумму. Применяется только к числам.

# sum

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

Добавлена в: v1.1.0

Вычисляет сумму числовых значений.

**Синтаксис**

```sql theme={null}
sum(num)
```

**Аргументы**

* `num` — Столбец с числовыми значениями. [`(U)Int*`](/ru/reference/data-types/int-uint) or [`Float*`](/ru/reference/data-types/float) or [`Decimal*`](/ru/reference/data-types/decimal)

**Возвращаемое значение**

Возвращает сумму значений. [`(U)Int*`](/ru/reference/data-types/int-uint) or [`Float*`](/ru/reference/data-types/float) or [`Decimal*`](/ru/reference/data-types/decimal)

**Примеры**

**Вычисление суммы зарплат сотрудников**

```sql title=Query theme={null}
CREATE TABLE employees
(
    id UInt32,
    name String,
    salary UInt32
)
ENGINE = Memory;

INSERT INTO employees VALUES
    (87432, 'John Smith', 45680),
    (59018, 'Jane Smith', 72350),
    (20376, 'Ivan Ivanovich', 58900),
    (71245, 'Anastasia Ivanovna', 89210);

SELECT sum(salary) FROM employees;
```

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