SQLite 3 reference · Math Functions

SQLite PI() Function

Return an approximation of pi (3.14159...). Useful for circles and converting between degrees and radians.

SQLite 3 Since 3.35.0

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

pi()

Return value

3.141592653589793.

Examples

The value
SELECT pi() AS pi;

Output

pi
3.141592653589793

Run this on your computer — see “Get Started” for setup.

Area and radians
SELECT round(pi() * power(5, 2), 2) AS circle_area, round(radians(180), 5) AS half_turn;

Output

circle_area | half_turn
78.54 | 3.14159

Run this on your computer — see “Get Started” for setup.

This is one of SQLite's built-in math functions, available since 3.35.0 when SQLite is compiled with SQLITE_ENABLE_MATH_FUNCTIONS (the default for the sqlite3 command-line tool and most language bindings). The in-browser SQLite on this site is built without them, so the examples show output from standard SQLite instead.

Version history

VersionChange
SQLite 3.35.0Added

Was this page helpful?