Skip to main content

abs

Returns the absolute value of x. Examples:
examples.sql
select abs(-1) as value; -- value '1.0'
Supported Signatures
function abs(tinyint) returns tinyint
function abs(smallint) returns smallint
function abs(bigint) returns bigint
function abs(double) returns double
function abs(decimal(p, s)) returns decimal(p, s)
function abs(real) returns real
๐Ÿ”— Official Documentation

acos

Returns the arc cosine of x. Examples:
examples.sql
select acos(0.5) as value; -- value '1.0471975511965976'
Supported Signatures
function acos(double) returns double
๐Ÿ”— Official Documentation

asin

Returns the arc sine of x. Examples:
examples.sql
select asin(1) as value; -- value '1.5707963267948966'
Supported Signatures
function asin(double) returns double
๐Ÿ”— Official Documentation

atan

Returns the arc tangent of x. Examples:
examples.sql
select atan(0) as value; -- value '0.0'
Supported Signatures
function atan(double) returns double
๐Ÿ”— Official Documentation

atan2

Returns the arc tangent of y / x. Examples:
examples.sql
select atan2(1, 0.5) as value; -- value '1.1071487177940904'
Supported Signatures
function atan2(double, double) returns double
๐Ÿ”— Official Documentation

cbrt

Returns the cube root of x. Examples:
examples.sql
SELECT cbrt(328509) as value; -- value '69.0'
Supported Signatures
function cbrt(double) returns double
๐Ÿ”— Official Documentation

ceil

This is an alias for ceiling(). Examples:
examples.sql
SELECT ceil(1.3) AS value; -- value '2.0'
Supported Signatures
function ceil(bigint) returns bigint
function ceil(double) returns double
function ceil(real) returns real
๐Ÿ”— Official Documentation

ceiling

Returns x rounded up to the nearest integer. Supported Signatures
function ceiling(bigint) returns bigint
function ceiling(double) returns double
function ceiling(real) returns real
๐Ÿ”— Official Documentation

cos

Returns the cosine of x. Examples:
examples.sql
select cos(1.0) as value; -- value '0.5403023058681398'
Supported Signatures
function cos(double) returns double
๐Ÿ”— Official Documentation

cosh

Returns the hyperbolic cosine of the given value. Examples:
examples.sql
SELECT cosh(0) AS value; -- value '1.0'
Supported Signatures
function cosh(double) returns double
๐Ÿ”— Official Documentation

degrees

Converts angle x in radians to degrees. Examples:
examples.sql
SELECT degrees(3.14159) AS value; -- value '179.9998547447946'
Supported Signatures
function degrees(double) returns double
๐Ÿ”— Official Documentation

exp

Returns Eulerโ€™s number raised to the power of x. Examples:
examples.sql
select exp(1.0) as value; -- value '2.718281828459045'
Supported Signatures
function exp(double) returns double
๐Ÿ”— Official Documentation

floor

Returns x rounded down to the nearest integer. Supported Signatures
function floor(bigint) returns bigint
function floor(double) returns double
๐Ÿ”— Official Documentation

is_nan

Determine if x is not-a-number. Examples:
examples.sql
select is_nan(1.1) as value; -- value 'false'
Supported Signatures
function is_nan(double) returns boolean
function is_nan(real) returns boolean
๐Ÿ”— Official Documentation

ln

Returns the natural logarithm of x. Examples:
examples.sql
select ln(2.1) as value; -- value '0.7419373447293773'
Supported Signatures
function ln(double) returns double
๐Ÿ”— Official Documentation

log

Returns the base b logarithm of x. Examples:
examples.sql
SELECT log(2.19, 1) AS value; -- value '0.0'
Supported Signatures
function log(double, double) returns double
๐Ÿ”— Official Documentation

log10

Returns the base 10 logarithm of x. Examples:
examples.sql
select log10(10) as value; -- value '1.0'
Supported Signatures
function log10(double) returns double
๐Ÿ”— Official Documentation

log2

Returns the base 2 logarithm of x. Examples:
examples.sql
select log2(2) as value; -- value '1.0'
Supported Signatures
function log2(double) returns double
๐Ÿ”— Official Documentation

mod

Returns the modulus (remainder) of n divided by m. Supported Signatures
function mod(bigint, bigint) returns bigint
function mod(double, double) returns double
๐Ÿ”— Official Documentation

pi

Returns the constant Pi. Examples:
examples.sql
SELECT PI() -- value '3.141592653589793'
Supported Signatures
function pi() returns double
๐Ÿ”— Official Documentation

pow

This is an alias for power(). Supported Signatures
function pow(double, double) returns double
๐Ÿ”— Official Documentation

power

Returns x raised to the power of p. Examples:
examples.sql
select power(2, 8) as value; -- value '256'
Supported Signatures
function power(double, double) returns double
๐Ÿ”— Official Documentation

radians

Converts angle x in degrees to radians. Examples:
examples.sql
SELECT radians(360) AS value; -- value '6.283185307179586'
Supported Signatures
function radians(double) returns double
๐Ÿ”— Official Documentation

rand

This is an alias for random(). Supported Signatures
function rand() returns double
Note: rand() is volatile, i.e. might return a different value for the same input. ๐Ÿ”— Official Documentation

random

Returns a pseudo-random value in the range 0.0 <= x < 1.0. Examples:
examples.sql
select random() as value; -- value '0.8781138533805801'
Supported Signatures
function random() returns double
Note: random() is volatile, i.e. might return a different value for the same input. ๐Ÿ”— Official Documentation

round

Returns x rounded to the nearest integer. Examples:
examples.sql
select round(2.1) as value; -- value '2.0'
Supported Signatures
function round(double) returns double
function round(double, bigint) returns double
function round(real) returns real
function round(real, bigint) returns real
๐Ÿ”— Official Documentation

sign

Returns the signum function of x, that is. Supported Signatures
function sign(decimal(p, s)) returns decimal(1, 0)
function sign(double) returns double
function sign(real) returns real
๐Ÿ”— Official Documentation

sin

Returns the sine of x. Examples:
examples.sql
select sin(2.1) as value; -- value '-0.8632093666488737'
Supported Signatures
function sin(double) returns double
๐Ÿ”— Official Documentation

sinh

Returns the hyperbolic sine of x. Examples:
examples.sql
SELECT sinh(1) AS value; -- value '1.1752011936438014'
Supported Signatures
function sinh(double) returns double
๐Ÿ”— Official Documentation

sqrt

Returns the square root of x. Examples:
examples.sql
select sqrt(16) as value; -- value '4.0'
Supported Signatures
function sqrt(double) returns double
๐Ÿ”— Official Documentation

tan

Returns the tangent of x. Examples:
examples.sql
select tan(0.5) as value; -- value '0.5463024898437905'
Supported Signatures
function tan(double) returns double
๐Ÿ”— Official Documentation

tanh

Returns the hyperbolic tangent of x. Examples:
examples.sql
SELECT tanh(1.0) AS value; -- value '0.7615941559557649'
Supported Signatures
function tanh(double) returns double
๐Ÿ”— Official Documentation

truncate

Returns x rounded to integer by dropping digits after decimal point. Examples:
examples.sql
SELECT truncate(1.23456, 2) as value; -- value '1.23'
Supported Signatures
function truncate(decimal(p, s), bigint) returns decimal(p, s)
function truncate(decimal(p, s)) returns decimal(rp, 0)
function truncate(double) returns double
function truncate(real) returns real
๐Ÿ”— Official Documentation