PostgreSQL/Math Functions/Power
Содержание
CAST(2 AS double precision) ^ CAST(3 AS double precision)
<source lang="sql">
postgres=# SELECT CAST(2 AS double precision) ^ CAST(3 AS double precision) AS "exp";
exp
8
(1 row) postgres=#
</source>
power(a dp, b dp) a raised to the power of b
<source lang="sql">
postgres=# --power(a dp, b dp) a raised to the power of b postgres=# select power(9.0, 3.0);
power
729.0000000000000000
(1 row) postgres=#
</source>
power(a numeric, b numeric) numeric a raised to the power of b
<source lang="sql">
postgres=# -- power(a numeric, b numeric) numeric a raised to the power of b postgres=# postgres=# select power(9.0, 3.0);
power
729.0000000000000000
(1 row) postgres=#
</source>
Power operator
<source lang="sql">
postgres=# SELECT 2 ^ 3 AS "exp";
exp
8
(1 row) postgres=#
</source>