Skip to main content

POWER

Functions › Number · Also written POW

Raises a number to a power. POW is the same function.

Syntax​

{ POWER | POW }( <base>, <exponent> )

Arguments​

ArgumentDescription
<base>A number, or text that reads as a number.
<exponent>A number, or text that reads as a number. May be negative or have a fraction.

Returns​

Always a float, even for integer arguments: POWER(2, 10) is 1024.0. NULL when either argument is NULL. Text that does not read as a number fails the query.

Usage notes​

  • A fractional exponent of a negative base has no real result and returns NaN.
  • Runs after the rows are read; it is not pushed to the data store.

Examples​

Compound growth over a number of years:

SELECT a.key, a.balance, a.rate, a.years,
ROUND(a.balance * POWER(1 + a.rate, a.years), 2) AS projected
FROM tables.crm.account a
keybalancerateyearsprojected
A-110000.0431124.86
A-225000.0252760.2

Not supported​

RefusedWrite instead
EXP(x), LN(x), LOG(x)Not available. POWER(2.718281828459045, x) stands in for EXP(x).
-- Refused by the engine
SELECT a.key, LN(a.balance) AS log_balance FROM tables.crm.account a

See also​

SQRT · ROUND