POWER
The POWER function is used to raise a number to the power of another number. It takes two arguments, the base and the exponent, both of which must be of the FLOAT type. The result will also be of the FLOAT type.
Syntax
POWER(base, exponent)
Examples
- Using the
POWERfunction:
SELECT POWER(2.0, 4) as power_1;
-- Result: 16.0
- Using the
POWERfunction with a decimal:
SELECT POWER(0.07, 3) as power_2;
-- Result: 0.000343
- Using the
POWERfunction with zero:
SELECT POWER(0, 4) as power_with_zero;
-- Result: 0.0
SELECT POWER(3, 0) as power_to_zero;
-- Result: 1.0
Error Cases
- The
POWERfunction requires both arguments to be of FLOAT type:
SELECT POWER('string', 'string') AS power;
-- Error: FunctionRequiresFloatValue("POWER")
- The
POWERfunction requires the base to be of FLOAT type:
SELECT POWER('string', 2.0) AS power;
-- Error: FunctionRequiresFloatValue("POWER")
- The
POWERfunction requires the exponent to be of FLOAT type:
SELECT POWER(2.0, 'string') AS power;
-- Error: FunctionRequiresFloatValue("POWER")