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

> Calcula a soma. Funciona apenas com números.

# sum

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

Introduzido em: v1.1.0

Calcula a soma de valores numéricos.

**Sintaxe**

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

**Argumentos**

* `num` — Coluna com valores numéricos. [`(U)Int*`](/pt-BR/reference/data-types/int-uint) ou [`Float*`](/pt-BR/reference/data-types/float) ou [`Decimal*`](/pt-BR/reference/data-types/decimal)

**Valor retornado**

Retorna a soma dos valores. [`(U)Int*`](/pt-BR/reference/data-types/int-uint) ou [`Float*`](/pt-BR/reference/data-types/float) ou [`Decimal*`](/pt-BR/reference/data-types/decimal)

**Exemplos**

**Calculando a soma dos salários dos funcionários**

```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 │
└─────────────┘
```
