PostgreSQL/Math Functions/PI

Материал из SQL эксперт
Перейти к: навигация, поиск

pi() constant

postgres=# -- pi() constant
postgres=# select pi();
        pi
------------------
 3.14159265358979
(1 row)
postgres=#



pi(): Returns the pi constant (3.14159...)

postgres=# -- pi(): Returns the pi constant (3.14159...)
postgres=#
postgres=# SELECT pi() AS "the pi constant";
 the pi constant
------------------
 3.14159265358979
(1 row)
postgres=#



Use pi() in calculation

postgres=#
postgres=# SELECT 2 + 2 AS "2 plus 2", pi() AS "the pi function", "PostgreSQL is more than a calculator!" AS comments;
 2 plus 2 | the pi function  |               comments
----------+------------------+---------------------------------------
        4 | 3.14159265358979 | PostgreSQL is more than a calculator!
(1 row)
postgres=#
postgres=#