The read-only analysis instance supports most MySQL mathematical functions. However, limitations and incompatibilities still exist in some scenarios. This document describes the list of mathematical functions supported by the read-only analysis instance and specifies the supported data types for each function's input parameters. Input parameter types and functions not listed in this document are not supported.
Supported Mathematical Operation Functions
ROUND Function
Round function.
Syntax: ROUND(x)
The data types supported by x are: decimal.
ABS Function
Absolute value function.
Syntax: ABS(x)
The data types supported by x are: int, bigint, double, decimal.
FLOOR Function
Floor function.
Syntax: FLOOR(x)
The data types supported by x are: int, bigint, double, decimal.
CEIL Function
Ceiling function.
Syntax: CEIL(x)
The data types supported by x are: int, bigint, double, decimal.
CEILING Function
The ceiling function is equivalent to CEIL.
Syntax: CEILING(x)
The data types supported by x are: int, bigint, double, decimal.
SQRT Function
Square root function.
Syntax: SQRT(x)
The data types supported by x are: int, bigint, double, decimal.
LOG Function
Natural logarithm function.
Syntax: LOG(x)
The data types supported by x are: int, bigint, double, decimal.
LOG2 Function
Logarithm function with base 2.
Syntax: LOG2(x)
The data types supported by x are: int, bigint, double, decimal.
LOG10 Function
Logarithm function to base 10.
Syntax: LOG10(x)
The data types supported by x are: int, bigint, double, decimal.
LN Function
Returns the natural logarithm of a number.
Syntax: LN(x)
The data types supported by x are: int, bigint, double, decimal.
EXP Function
Returns e raised to the power of x.
Syntax: EXP(x)
The data types supported by x are: int, bigint, double, decimal.
POW Function
Calculates x raised to the power of y.
Syntax: POW(x, y)
The data types supported by x are: int, bigint, double, decimal.
The data types supported by y are: int, bigint, double, decimal.
SIGN Function
Determines the sign of a real number.
Syntax: SIGN(x)
The data types supported by x are: int, bigint, double, decimal.
RADIANS Function
Converts an angle to radians.
Syntax: RADIANS(x)
The data types supported by x are: int, bigint, double, decimal.
DEGREES Function
Converts radians to degrees.
Syntax: DEGREES(x)
The data types supported by x are: int, bigint, double, decimal.
CONV Function
Converts a number from one base to another and returns the result as a string.
Syntax: CONV(n, from_base, to_base)
The data types supported by n are: int, bigint, double, decimal.
from_base supports the following data types: int, bigint, double, decimal.
to_base supports the following data type: int.
CRC32 Function
Cyclic redundancy check function.
Syntax: CRC32(expr)
expr supports the following data types: int, bigint, double, decimal.
GREATEST Function
Return the maximum value among N values.
Syntax: GREATEST(value1, value2, ...)
The data types supported by parameters such as value1 and value2 are: int, bigint, double, decimal.
LEAST Function
Return the minimum value among N values.
Syntax: LEAST(value1, value2, ...)
The data types supported by parameters such as value1 and value2 are: int, bigint, double, decimal.
TRUNCATE Function
Truncates a value to a specified number of decimal places (direct truncation, no rounding).
Syntax: TRUNCATE(X, D)
When D is greater than 0, it truncates the decimal places of X, retaining D decimal places.
When D equals 0, it removes the decimal part of X, retaining only the integer part.
When D is less than 0, it removes the decimal part of X and replaces the |D| lowest-order digits of the integer part with zeros.