> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for STDDEV_SAMP

# STDDEV_SAMP

Computes the sample standard deviation of all non-`NULL` numeric values produced by an expression.
The sample standard deviation measures how spread out values are in a sample by calculating the square root of the average of squared deviations from the sample mean, using a correction for sample size. For information about the population standard deviation, which estimates the spread of values in the full population, see [STDDEV\_POP](/reference-sql/functions-reference/aggregation/stddev-pop).

**Alias**: `STDDEV`

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{ STDDEV | STDDEV_SAMP }(<expression>) [FILTER ([WHERE] <condition>)]
```

## Parameters

| Parameter      | Description                                                                                  | Supported input types      |
| :------------- | :------------------------------------------------------------------------------------------- | :------------------------- |
| `<expression>` | An expression producing numeric values for which to calculate the sample standard deviation. | `REAL`, `DOUBLE PRECISION` |
| `<condition>`  | An optional boolean expression to filter rows used in aggregation                            | `BOOL`                     |

## Return Type

`STDDEV_SAMP` returns a result of type `DOUBLE PRECISION`.

### Special cases

* If there is at most one non-`NULL` input value, the result is `NULL`.
* If the input contains an `Inf` or `NaN` value, the result will be `NaN`.

## Example

The following example calculates the sample standard deviation of five grade values:

<div className="query-window">
  ```
  SELECT ROUND(STDDEV_SAMP(grade::double precision), 3) AS stddev
  FROM UNNEST(ARRAY[4.0, 3.7, 3.3, 2.7, 2.7]) AS t(grade);
  ```

  | stddev <span>double null</span> |
  | :------------------------------ |
  | 0.585                           |

  <p><span>Rows: 1</span><span>Execution time: 6.55ms</span></p>
</div>
