---
title: "Agrega\u010Dn\u00ED funkce Stddev"
description: "Skupinov\u00E1 funkce pro zji\u0161t\u011Bn\u00ED sm\u011Brodatn\u00E9 odchylky ze skupiny \u010D\u00EDseln\u00FDch hodnot."
language: cs
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/cs/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:48:50Z
license: https://documentation.invantive.eu/cs/
---

## Syntaxe
```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))
```

## Účel
Skupinová funkce pro zjištění směrodatné odchylky ze skupiny číselných hodnot. Směrodatná odchylka základního souboru se počítá tak, že součet čtverců odchylek od průměru se dělí počtem hodnot. Výsledek pro skupinu s jednou jedinou hodnotou je 0. S `DISTINCT` se každá jedinečná hodnota zahrne jednou. S `ALL`, což je výchozí nastavení, se každá hodnota počítá tolikrát, kolikrát se vyskytuje; `ALL` je přijímáno od verze 28.0.

## Příklady
Následující příklad počítá směrodatnou odchylku nesplacených zůstatků zákazníků segmentu Wholesale, například aby bylo možné posoudit, jak rovnoměrně je úvěrové riziko rozloženo v rámci segmentu:
```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
```
Následující příklad počítá směrodatnou odchylku nesplacených zůstatků podle segmentu zákazníků, bez zákazníků bez zůstatku:
```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
```

