Updated on 2026-11-06 GMT+08:00

sqrt

The sqrt function is used to return the square root of a numeric value.

Syntax

sqrt(DOUBLE a) 

Parameters

Parameter

Mandatory

Type

Description

a

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The format of parameter a includes floating-point format, integer format, and string format. If parameter a is not of type DOUBLE, it is implicitly converted to DOUBLE type before evaluation.

Return Values

Returns a value of type DOUBLE.

If a is NULL, NULL is returned.

Example Code

Returns 2.8284271247461903.

select sqrt(8); 

Returns 4.

select sqrt(16); 

Returns NULL.

select sqrt(null);