---
title: "Stddev\u96C6\u8A08 Function (*.fnc)"
description: "\u30B0\u30EB\u30FC\u30D7\u5185\u306E\u6570\u5024\u306E\u96C6\u5408\u304B\u3089\u6A19\u6E96\u504F\u5DEE\u3092\u6C42\u3081\u308B\u30B0\u30EB\u30FC\u30D7\u95A2\u6570\u3067\u3059\u3002"
language: ja
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ja/docs/invantive-universalsql/grammar/aggregate-functions/stddev-aggregate-function
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/aggregate-functions/stddev-aggregate-function
updated: 2026-12-04T12:49:03Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    stdDevAggregateFunction_start((START))
    stdDevAggregateFunction_start --> stdDevAggregateFunction_0_0[STDDEV]:::quoted
    stdDevAggregateFunction_0_0 --> stdDevAggregateFunction_0_1["("]:::quoted
    stdDevAggregateFunction_0_1 --> stdDevAggregateFunction_0_2[DISTINCT]:::quoted
    stdDevAggregateFunction_0_1 --> stdDevAggregateFunction_0_2a[ALL]:::quoted
    stdDevAggregateFunction_0_2a --> stdDevAggregateFunction_0_3
    stdDevAggregateFunction_0_2 --> stdDevAggregateFunction_0_3[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    stdDevAggregateFunction_0_3 --> stdDevAggregateFunction_0_4[")"]:::quoted
    stdDevAggregateFunction_0_4 --> stdDevAggregateFunction_end((END))
```

## 目的
グループ内の数値の集合から標準偏差を求めるグループ関数です。 母集団の標準偏差を計算します。平均からの偏差の二乗の合計を値の数で割ります。 値が1つだけのグループの結果は 0 です。 `DISTINCT` を指定すると、一意の各値は1回だけ含まれます。 `ALL`(既定値)を指定すると、各値は出現した回数分だけ計上されます。`ALL`はリリース28.0から使用できます。

## 例
次の例では、Wholesale顧客の未払残高の標準偏差を計算します。たとえば、セグメント内で信用リスクがどの程度均等に分散しているかを判断するためです:
```sql
select stddev(cus.balance)
from   csvtable
       ( passing 'Acme Industries#Manufacturing#12500#50000|Bergmann GmbH#Manufacturing#0#25000|Carlson Ltd#Wholesale#2500#10000|Dubois SA#Wholesale#7500#10000|Everest BV#Services##5000'
         row delimiter '|'
         column delimiter '#'
         columns name         varchar2 position next
         ,       segment      varchar2 position next
         ,       balance      number   position next
         ,       credit_limit number   position next
       ) cus
where  cus.segment = 'Wholesale'

-------------------
2500
```
次の例では、残高のない顧客を除外して、顧客セグメントごとの未払残高の標準偏差を計算します:
```sql
select cus.segment
,      stddev(cus.balance)
from   csvtable
       ( passing 'Acme Industries#Manufacturing#12500#50000|Bergmann GmbH#Manufacturing#0#25000|Carlson Ltd#Wholesale#2500#10000|Dubois SA#Wholesale#7500#10000|Everest BV#Services##5000'
         row delimiter '|'
         column delimiter '#'
         columns name         varchar2 position next
         ,       segment      varchar2 position next
         ,       balance      number   position next
         ,       credit_limit number   position next
       ) cus
where  cus.balance is not null
group
by     cus.segment
order
by     cus.segment

-------------------
Manufacturing    6250
Wholesale        2500
```

