PI

Returns a constant value of π

Syntax

PI( )

Arguments

None

Returns

Always returns a floating point value of π, to 10 digits after the decimal.

Examples

Using PI() to represent degrees in radians

CREATE TABLE trig(f DOUBLE);

INSERT INTO trig VALUES (0), (PI()/12), (PI()/8), (PI()/6)
   , (PI()/4), (PI()/3), (3*PI()/8), (5*PI()/12), (PI()/2);

Tangent of π/4 (= 1)

Tip

Use RADIANS to convert degrees to radians

numbers=> SELECT TAN(PI()/4), TAN(RADIANS(45));
tan | tan0
----+-----
  1 |    1

Sine of π/2 (= 1)

numbers=> SELECT SIN(PI()/2), SIN(RADIANS(90));
sin | sin0
----+-----
  1 |    1