SQLite Math Functions

The following table shows the SQLite math functions allowing you to perform mathematical calculations in your queries effectively.

Function NameDescription
abs()Returns the absolute value of a number.
acos()Returns the arc cosine of a number, in radians.
acosh()Returns the inverse hyperbolic cosine of a number.
asin()Returns the arc sine of a number, in radians.
asinh()Returns the inverse hyperbolic sine of a number.
atan()Returns the arc tangent of a number in radians.
atan2()Returns the arc tangent of y/x, in radians, where y and x are the two parameters.
atanh()Returns the inverse hyperbolic tangent of a number.
ceil()Returns the smallest integer value greater than or equal to a given number.
ceiling()Same as ceil().
cos()Returns the cosine of a number, in radians.
cosh()Returns the hyperbolic cosine of a number.
degrees()Converts a value in radians to degrees.
exp()Returns the result of e (Euler’s number) raised to the power of a given number.
floor()Returns the largest integer value less than or equal to a given number.
ln()Returns the natural logarithm (base e) of a number.
log(B)Returns the logarithm of a number to the base B.
log()Returns the natural logarithm (base e) of a number. (Synonym for ln())
log10()Returns the base-10 logarithm of a number.
log2()Returns the base-2 logarithm of a number.
mod()Returns the remainder of a division operation.
pi()Returns the pi constant (π).
pow()Same as power().
power()Returns a number raised to the power of another number.
radians()Converts a value in degrees to radians.
random()Returns a random integer.
sin()Returns the sine of a number, in radians.
sinh()Returns the hyperbolic sine of a number.
sqrt()Returns the square root of a number.
tan()Returns the tangent of a number in radians.
tanh()Returns the hyperbolic tangent of a number.
trunc()Returns the integer part of a number, rounding to zero.
round()Rounds a number to a specified number of decimal places.
Was this tutorial helpful ?