PostgreSQL power() Function
The PostgreSQL power()
function returns a specified number raised to the specified power. For example, power(x, y)
return the y
-th power of x
.
power()
Syntax
This is the syntax of the PostgreSQL power()
function:
power(x, y) -> numeric_type
Parameters
x
-
Required.
y
-
Required.
Return value
PostgreSQL power(x, y)
returns The y
-th power of x
.
The power()
function will return NULL
if either argument is NULL
.
PostgreSQL will give an error if you supply a parameter that is not a numeric type.
power()
Examples
Here are a few examples of the power()
function:
SELECT
power(3, 4) AS "power(3, 2)",
power(3.3, 1.2) AS "power(3.3, 1.2)";
power(3, 2) | power(3.3, 1.2)
-------------+--------------------
81 | 4.1900260963770137