What is PI() in SQL?

The PI() function returns the value of Pi.

Figure 1 shows a visual representation of the PI() function.

Figure 1: Visual representation of PI() function

Syntax

PI()

Parameter

The PI() function does not require a parameter.

Return value

The PI() function returns the value of Pi.

By default, the PI() function returns a value of Pi of up to 6 decimal places.

Code

-- simple PI() upto 6 decimal places
SELECT PI();
-- increase the number of decimal places to 10
SELECT PI() + 0.0000000000;
New on Educative
Learn any Language for FREE all September 🎉
For the entire month of September, get unlimited access to our entire catalog of beginner coding resources.
🎁 G i v e a w a y
30 Days of Code
Complete Educative’s daily coding challenge every day in September, and win exciting Prizes.

Free Resources