POWER()
Raises a base to a specified exponent.
Description
POWER raises a base number to a given exponent (base ^ exponent). It's used
for growth calculations, squaring values, and any exponential math. POWER(2, 3)
is 8. The alias POW is also common.
Syntax
POWER(base, exponent)
POW(base, exponent)Parameters
| Name | Description | Optional |
|---|---|---|
| base | The value to exponentiate. | No |
| exponent | The power to raise it to. | No |
Return Type
Returns a DOUBLE.
Examples
Store (Customers/Orders/Products)
Loading database engine...
Store (Customers/Orders/Products)
Loading database engine...
Square roots via exponent
POWER(x, 0.5) is the same as SQRT(x). Use fractional exponents for other
roots.
Common Mistakes
- Negative base with fractional exponent. This can produce a complex number and error in SQL, which only handles reals.
- Integer overflow expectations. Results are DOUBLE; very large powers can overflow to infinity.
- Confusing with multiplication.
POWER(2, 3)is8, not6.
Related Functions
See also: SQRT, EXP, ABS.