---
title: sqrt function
description: Learn the syntax of the sqrt function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/sqrt
---

# `sqrt` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the square root of `expr`.

## Syntax

```
sqrt(expr)
```

## Arguments

* `expr`: An expression that evaluates to a numeric.

## Returns

For DECFLOAT inputs, the result is DECFLOAT with the same precision as `expr`. For other inputs, the result is a `DOUBLE`.

If `expr` is negative the result is `NaN`.

## Examples

```sql
> SELECT sqrt(4);
 2.0

> SELECT sqrt(-4);
 NaN
```

## Related functions

* [`cbrt` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/cbrt.md)
