MySQL: PI Function

  • Post author:
  • Post category:MySQL
  • Post comments:1 Comment
MySQL PI Function

In this guide, we will explain how to use the MySQL PI function with syntax and examples.

Description

The MySQL PI function returns the value of π (pi) displayed with 6 decimal places.

Syntax

The syntax for the PI function in MySQL is:

PI( )

Parameters or Arguments

There are no parameters or arguments for the PI function.

Note

  • The PI function displays the value of pi with only 6 decimal places. However, internally it uses the double-precision value when used in calculations with other double-precision values.
  • See also the DEGREES and RADIANS functions.

Applies To

The PI function can be used in the following versions of :

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let’s look at some PI function examples and explore how to use the PI function.

For example:

mysql> SELECT PI();
Result: 3.141593

mysql> SELECT PI()*1;
Result: 3.141593

mysql> SELECT PI()*1.000000000000000;
Result: 3.141592653589793

Next Topic : Click Here

This Post Has One Comment

Leave a Reply