w3resource

MySQL PI() function

PI() function

MySQL PI() returns the value of π(pi) which represents the ratio of the circumference of a circle to its diameter.

This function is useful in -

  • PI() provides a precise and predefined value of π, which is necessary for various mathematical calculations involving circles, spheres, and trigonometric functions.
  • In geometry and trigonometry, π is a fundamental constant used to calculate the properties of circles, such as area, circumference, and angles.
  • In engineering and physics, π is frequently used in formulas related to waves, oscillations, rotations, and other physical phenomena.
  • In computer graphics and visualization, π is used extensively for rendering curves, circles, and other geometric shapes.
  • Many trigonometric functions (such as sine, cosine, and tangent) involve π in their formulas.
  • The PI() function is crucial for accurate statistical calculations.
  • In statistics, the normal distribution, which is a fundamental concept in probability theory, often involves π in its formulas.

Syntax:

PI();

MySQL Version: 8.0


Pictorial presentation of MySQL PI() function

pictorial presentation of MySQL PI() function

Example of MySQL PI() function

Code:

SELECT PI();

Explanation:

The above MySQL statement returns the value of PI().

Output:

mysql> SELECT PI();
+----------+
| PI()     |
+----------+
| 3.141593 | 
+----------+
1 row in set (0.00 sec)

All Mathematical Functions

Previous: OCT()
Next: POW()



Follow us on Facebook and Twitter for latest update.