MySQL PI() Function

The PI() function in MySQL returns the value of the mathematical constant pi (π).



PI(): Definition and Usage

Pi (π) is the ratio of a circle's circumference to its diameter, approximately 3.14159. The PI() function is useful in calculations involving circles, spheres, or other geometric shapes, and in any situation where the value of pi is needed.

Syntax

The PI() function is very simple; it doesn't take any arguments:

Syntax

PI()
      

Related Functions

For converting between radians and degrees, see the DEGREES() and RADIANS() functions.

Example

Retrieving the Value of Pi

This query demonstrates how to use the PI() function to get the value of pi.

Syntax

SELECT PI();
      
Output

3.141592653589793