Cloud Software Group, Inc. EBX®
Documentation > Developer Guide > SQL in EBX®
Navigation modeDocumentation > Developer Guide > SQL in EBX®

Arithmetic operators and functions

The following table lists all of the SQL arithmetic operators and functions supported by EBX®, along with their standard SQL syntax. Some functions can have optional parameters: they are surrounded by square brackets.

Operator syntax

Description and example(s)

+ numeric

Returns numeric

SELECT +4 :  4

- numeric

Returns numeric

SELECT -4 :  -4

numeric1 + numeric2

Returns numeric1 plus numeric2

SELECT 18 + 4 :  22

numeric1 - numeric2

Returns numeric1 minus numeric2

SELECT 18 - 4 :  14

numeric1 * numeric2

Returns numeric1 multiplied by numeric2

SELECT 18 * 4 :  72

numeric1 / numeric2

Returns numeric1 divided by numeric2

SELECT 18 / 4 :  4

ABS(numeric)

Returns the absolute value of numeric

SELECT ABS(-243.5) :  243.5

ACOS(numeric)

Returns the arc cosine of numeric

SELECT ACOS(-1) :  3.141592653589793

ASIN(numeric)

Returns the arc sine of numeric

SELECT ABS(0.25) :  0.25

ATAN(numeric)

Returns the arc tangent of numeric

SELECT ATAN(2.5) :  1.1902899496825317

ATAN2(numeric, numeric)

Returns the arc tangent of the numeric coordinates

SELECT ATAN2(0.50, 1) :  0.4636476090008061

CEIL(numeric)

Rounds numeric up, and returns the smallest number that is greater than or equal to numeric

SELECT CEIL(25.75) :  26

CEILING(numeric)

Rounds numeric up, and returns the smallest number that is greater than or equal to numeric

SELECT CEILING(25.75) :  26

COS(numeric)

Returns the cosine of numeric

SELECT COS(2) :  -0.4161468365471424

COT(numeric)

Returns the cotangent of numeric

SELECT COT(6) :  -3.436353004180128

DEGREES(numeric)

Converts numeric from radians to degrees

SELECT DEGREES(1.5) :  85.94366926962348

EXP(numeric)

Returns e raised to the power of numeric

SELECT EXP(1) :  2.718281828459045

FLOOR(numeric)

Rounds numeric down, and returns the largest number that is less than or equal to numeric

SELECT FLOOR(25.75) :  25

LN(numeric)

Returns the natural logarithm (base e) of numeric

SELECT LN(2) :  0.6931471805599453

LOG10(numeric)

Returns the base-10 logarithm of numeric

SELECT LOG10(2) :  0.3010299956639812

MOD(numeric1, numeric2)

Returns the remainder (modulus) of numeric1 divided by numeric2. The result is negative only if numeric1 is negative

SELECT MOD(18, 4) :  2

POWER(numeric1, numeric)

Returns numeric1 raised to the power of numeric2

SELECT POWER(4, 2) :  16.0

RADIANS(numeric)

Converts numeric from degrees to radians

SELECT RADIANS(180) :  3.141592653589793

RAND([seed])

Returns a random double using numeric as the seed value if specified

SELECT RAND(6) :  0.9891840064573959

RAND_INTEGER([seed,] numeric)

Generates a random integer between 0 and numeric - 1 inclusive, initializing the random number generator with seed if specified

SELECT RAND_INTEGER(100, 5) :  0

SELECT RAND_INTEGER(6, 100) :  11

ROUND(numeric1, numeric2)

Rounds numeric1 to numeric2 places right to the decimal point

SELECT ROUND(135.375, 2) :  135.38

SIGN(numeric)

Returns the signum of numeric

SELECT SIGN(255.5) :  1

SIN(numeric)

Returns the sine of numeric

SELECT SIN(2) :  0.9092974268256817

SQRT(numeric)

Returns the square root of numeric

SELECT SQRT(64) :  8.0

TAN(numeric)

Returns the tangent of numeric

SELECT TAN(1.75) :  -5.52037992250933

TRUNCATE(numeric1[, numeric2])

Truncates numeric1 to 0 (if no numeric2 specified) places right to the decimal point

SELECT TRUNCATE(135.375) :  135

SELECT TRUNCATE(135.375, 2) :  135.37

Documentation > Developer Guide > SQL in EBX®