SQLite 3 reference · Math Functions
SQLite POWER() Function
Raise a number to a power, so power(2, 10) is 1024. pow() is another name for the same function.
SQLite 3 Since 3.35.0
Syntax
power(X, Y) | pow(X, Y)
Parameters
| Parameter | Description |
|---|---|
X |
The base. |
Y |
The exponent. |
Return value
A floating-point number.
Examples
SELECT power(2, 10) AS a, pow(9, 0.5) AS square_root;
Output
a | square_root 1024 | 3
Run this on your computer — see “Get Started” for setup.
SELECT round(1000 * power(1 + 0.05, 10), 2) AS after_10_years;
Output
after_10_years 1628.89
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 |
In other languages
POWER()· PostgreSQL
Related
SQRT()· Return the square root of a number, such as sqrt(16) = 4. Negative numbers give NULL rather than an error.EXP()· Return e (about 2.718) raised to a power, so exp(1) is e. It is the inverse of the ln() function.LOG()· Return the base-10 logarithm of a number, or the logarithm in any base with log(B, X). log10() and log2() also exist.- SQL Aggregate Functions · tutorial