> ## 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.

> 合計を計算します。数値に対してのみ使用できます。

# sum

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

導入バージョン: v1.1.0

数値の合計を計算します。

**構文**

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

**引数**

* `num` — 数値型の値を含むカラム。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float) または [`Decimal*`](/ja/reference/data-types/decimal)

**戻り値**

値の合計を返します。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float) または [`Decimal*`](/ja/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 │
└─────────────┘
```
