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
Syntax
pi()
Return value
3.141592653589793.
Examples
SELECT pi() AS pi;
Output
pi 3.141592653589793
Run this on your computer — see “Get Started” for setup.
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
| Version | Change |
|---|---|
| SQLite 3.35.0 | Added |
Related
POWER()· Raise a number to a power, so power(2, 10) is 1024. pow() is another name for the same function.- SQL Aggregate Functions · tutorial