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

> Applies the one-sample Student t-test to a sample and a known population mean.

# studentTTestOneSample

<h2 id="studentTTestOneSample">
  studentTTestOneSample
</h2>

Introduced in: v25.10.0

Applies the one-sample Student's t-test to determine whether the mean of a sample differs from a known population mean.

Normality is assumed. The null hypothesis is that the sample mean equals the population mean.

The optional `confidence_level` enables confidence interval calculation.

**Notes:**

* At least 2 observations are required; otherwise the result is `(nan, nan)` (and intervals if requested are `nan`).
* Constant or near-constant input will also return `nan` due to zero (or effectively zero) standard error.

**See Also**

* [Student's t-test](https://en.wikipedia.org/wiki/Student%27s_t-test)
* [studentTTest function](/reference/functions/aggregate-functions/studentTTest)

**Syntax**

```sql theme={null}
studentTTestOneSample([confidence_level])(sample_data, population_mean)
```

**Parameters**

* `confidence_level` — Optional. Confidence level for confidence intervals. Float in (0, 1). [`Float*`](/reference/data-types/float)

**Arguments**

* `sample_data` — Sample data. [`Integer`](/reference/data-types/int-uint) or [`Float`](/reference/data-types/float) or [`Decimal`](/reference/data-types/decimal)
* `population_mean` — Known population mean to test against (usually a constant). [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float) or [`Decimal`](/reference/data-types/decimal)

**Returned value**

Returns a tuple with two or four elements (if `confidence_level` is specified): calculated t-statistic, calculated p-value (two-tailed), \[calculated confidence-interval-low], \[calculated confidence-interval-high]. Confidence intervals are for the sample mean at the given confidence level. [`Tuple(Float64, Float64)`](/reference/data-types/tuple) or [`Tuple(Float64, Float64, Float64, Float64)`](/reference/data-types/tuple)

**Examples**

**Without confidence interval**

```sql title=Query theme={null}
SELECT studentTTestOneSample()(value, 20.0) FROM t;
```

```response title=Response theme={null}
```

**With confidence interval (95%)**

```sql title=Query theme={null}
SELECT studentTTestOneSample(0.95)(value, 20.0) FROM t;
```

```response title=Response theme={null}
```

**See Also**

* [Student's t-test](https://en.wikipedia.org/wiki/Student%27s_t-test)
* [studentTTest function](/reference/functions/aggregate-functions/studentTTest)
