POW Function in BigQuery
The POW function in BigQuery is a mathematical function that returns the value of base raised to the power of exponent. It is an essential tool for performing exponential calculations, financial modeling, and scientific data analysis.
Syntax
SQL
POW(X, Y)
- X: The base numeric value.
- Y: The exponent numeric value.
Example 1: Raising a number to a positive power.
SQL
-- Calculates 2^3 = 8 SELECT POW(2, 3) AS pow_value;
Example 2: Raising a number to a negative power.
SQL
-- Calculates 10^-1 = 0.1 SELECT POW(10, -1) AS pow_value;
Example 3: Calculating the square root using power (base^0.5).
SQL
-- Returns 4.0 SELECT POW(16, 0.5) AS pow_value;
Note: The POW function returns FLOAT64.