# stddev\_samp

[Read this page in HTML](https://www.scopedb.io/docs/reference/functions/aggregate/stddev_samp)

Returns the sample standard deviation of non-NULL values.

## Syntax

```scopeql
stddev_samp(<expr>)
```

## Arguments

| Argument | Type                      | Description  |
| -------- | ------------------------- | ------------ |
| `<expr>` | `int`, `uint`, or `float` | Input value. |

## Returns

Returns `float`. Ignores NULL values. Returns NULL when fewer than two non-NULL values are available.

## Examples

Estimate how much request latency varies across channels from a sample of requests:

```scopeql
VALUES
    ('web', 100.0), ('web', 120.0), ('web', 140.0),
    ('mobile', 60.0), ('mobile', 120.0), ('mobile', 180.0)
SELECT $0 AS channel, $1 AS latency_ms
GROUP BY channel
AGGREGATE avg(latency_ms) AS avg_ms, stddev_samp(latency_ms) AS stddev_ms
ORDER BY channel
```

```text
+---------+--------+-----------+
| channel | avg_ms | stddev_ms |
+---------+--------+-----------+
| mobile  | 120.0  | 60.0      |
| web     | 120.0  | 20.0      |
+---------+--------+-----------+
```

Both channels average 120 ms, but mobile durations vary more. The sample standard deviation is measured in ms.
