POWER¶
Returns the value of x to the power of y (xy).
POWER(x,2)
is equivalent to SQUARE(x)
.
Some DBMSs call this feature POW
.
See also: SQUARE.
Syntax¶
POWER( base, exponent )
Arguments¶
Parameter |
Description |
---|---|
|
Numeric expression ( |
|
Numeric expression ( |
Returns¶
Returns the same type as the argument supplied.
Notes¶
If the value is NULL, the result is NULL.
Examples¶
On integers¶
numbers=> SELECT POWER(3,x) FROM (VALUES (1), (2), (3), (4), (5)) AS t(x);
power
-----
3
9
27
81
243
On floating point¶
numbers=> SELECT POWER(3.0::double,x) FROM (VALUES (1), (2), (3), (4), (5)) AS t(x);
power
-----
3.0
9.0
27.0
81.0
243.0