SQRT Function in BigQuery
The SQRT function in BigQuery is a mathematical function that returns the square root of a numeric expression. This function is commonly used in statistical analysis, geometry calculations, and engineering data processing within BigQuery.
Syntax
SQL
SQRT(numeric_expression)
- numeric_expression: The number (FLOAT64 or NUMERIC) for which you want to find the square root. The value must be greater than or equal to 0.
Example 1: Basic square root calculation.
SQL
-- Returns 5.0 SELECT SQRT(25) AS sqrt_value;
Example 2: Square root of a decimal number.
SQL
-- Returns approximately 1.41421356... SELECT SQRT(2) AS sqrt_value;
Note: If the input value is negative, the SQRT function will return an error: Argument to SQRT cannot be negative