SQLite Tutorial SQLite Advanced SQLite Database SQLite References

SQLite PI() Function



The SQLite PI() function returns the value of 𝜋 (pi).

Syntax

PI()

Parameters

No parameter is required.

Return Value

Returns the value of 𝜋.

Example 1:

The example below shows the usage of PI() function.

SELECT PI();
Result: 3.14159265358979

SELECT PI() / 2;
Result: 1.5707963267949

Example 2:

Consider a database table called Sample with the following records:

DataRadius
Data 11
Data 22
Data 33
Data 44
Data 55

The statement given below can be used to calculate the area of the circle where radius is specified by values of column Radius.

SELECT *, (PI() * Radius * Radius) AS Area FROM Sample;

This will produce the result as shown below:

DataRadiusArea
Data 113.14159265358979
Data 2212.5663706143592
Data 3328.2743338823081
Data 4450.2654824574367
Data 5578.5398163397448

❮ SQLite Functions