# SQRT Function

Computes the square root of the input parameter. Input value can be a Decimal or Integer literal or a reference to a column containing numeric values. All generated values are non-negative.

Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

## Basic Usage

Numeric literal example:

sqrt(25)

Output: Returns the square root of 25, which is 5.

Column reference example:

sqrt(MyValue)

Output: Returns the square root of the values of the MyValue column.

## Syntax and Arguments

sqrt(numeric_value)

Argument

Required?

Data Type

Description

numeric_value

Y

string, decimal, or integer

Name of column or Decimal or Integer literal to apply to the function

For more information on syntax standards, see Language Documentation Syntax Notes.

### numeric_value

Name of the column or numeric literal whose values are used to compute the square root.

Nota

Negative input values generate null output values.

• Missing input values generate missing results.

• Literal numeric values should not be quoted.

• Multiple columns and wildcards are not supported.

Usage Notes:

Required?

Data Type

Example Value

Yes

String (column reference) or Integer or Decimal literal

25

## Examples

Suggerimento

### Example - Pythagorean Theorem

In this example, you learn how to compute exponentials and square roots on your numeric data.

Functions:

Item

Description

POW Function

Computes the value of the first argument raised to the value of the second argument.

SQRT Function

Computes the square root of the input parameter. Input value can be a Decimal or Integer literal or a reference to a column containing numeric values. All generated values are non-negative.

Source:

The dataset below contains values for x and y:

X

Y

3

4

4

9

8

10

30

40

Transformation:

You can use the following transformation to generate values for z2.

Nota

Do not add this step to your recipe right now.

 Transformation Name New formula Single row formula (POW(x,2) + POW(y,2)) 'Z'

You can see how column Z is generated as the sum of squares of the other two columns, which yields z2.

Now, edit the transformation to wrap the value computation in a SQRT function. This step is done to compute the value for z, which is the distance between the two points based on the Pythagorean theorem.

 Transformation Name New formula Single row formula SQRT((POW(x,2) + POW(y,2))) 'Z'

Results:

X

Y

Z

3

4

5

4

9

9.848857801796104

8

10

12.806248474865697

30

40

50