PostgreSQL/Math Functions/Pow

Материал из SQL эксперт
Версия от 13:14, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

pow(0) AS "two cubed", pow(0) AS "two squared", pow(0) AS "just two"

   <source lang="sql">

postgres=# postgres=# SELECT pow(2.0, 3.0) AS "two cubed", postgres-# pow(2.0, 2.0) AS "two squared", postgres-# pow(2.0, 1.0) AS "just two";

    two cubed      |    two squared     |      just two

+--------------------+--------------------
8.0000000000000000 | 4.0000000000000000 | 2.0000000000000000

(1 row) postgres=#

      </source>
   
  


pow(x, y): Returns value of x to the exponential power of y

   <source lang="sql">

postgres=# postgres=# -- pow(x, y): Returns value of x to the exponential power of y postgres=# select pow(2.0, 3) AS "two cubed";

    two cubed

8.0000000000000000

(1 row) postgres=#

      </source>