Documentation

SQL math functions

The InfluxDB SQL implementation supports the following math functions for performing mathematic operations:

abs

Returns the absolute value of a number.

abs(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View abs query example

acos

Returns the arc cosine or inverse cosine of a number.

acos(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View acos query example

asin

Returns the arc sine or inverse sine of a number.

asin(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View asin query example

atan

Returns the arc tangent or inverse tangent of a number.

atan(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View atan query example

atan2

Returns the arc tangent or inverse tangent of expression_y / expression_x.

atan2(expression_y / expression_x)
Arguments
  • expression_y: First numeric column or literal value to operate on.
  • expression_x: Second numeric column or literal value to operate on.

View atan2 query example

ceil

Returns the nearest integer greater than or equal to a number.

ceil(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View ceil query example

cos

Returns the cosine of a number.

cos(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View cos query example

exp

Returns the base-e exponential of a number.

exp(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to use as the exponent.

View exp query example

floor

Returns the nearest integer less than or equal to a number.

floor(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View floor query example

ln

Returns the natural logarithm of a number.

ln(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View ln query example

log10

Returns the base-10 logarithm of a number.

log10(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View log10 query example

log2

Returns the base-2 logarithm or a number.

log2(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View log2 query example

power

Returns a base number raised to the power of an exponent.

power(base, exponent)
Arguments
  • power: Base numeric column or literal value to operate on.
  • exponent: Exponent numeric column or literal value to operate on.

View power query example

random

Returns a random float value between 0 and 1. The random seed is unique to each row.

random()

View random query example

round

Rounds a number to the nearest integer.

round(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View round query example

signum

Returns the sign of a number. Negative numbers return -1. Zero and positive numbers return 1.

signum(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View signum query example

sin

Returns the sine of a number.

sin(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View sin query example

sqrt

Returns the square root of a number.

sqrt(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View sqrt query example

tan

Returns the tangent of a number.

tan(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View tan query example

trunc

Truncates a number toward zero (at the decimal point).

trunc(numeric_expression)
Arguments
  • numeric_expression: Numeric column or literal value to operate on.

View trunc query example


Was this page helpful?

Thank you for your feedback!


Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.

InfluxDB Cloud powered by IOx