Skip to content

Numeric functions

Rounding, division, base conversion and numeric calculations.

Rounding, division, base conversion and numeric calculations.

bit_count

SignaturePurposeSource definition
mysql.bit_count(bigint) → integerCount the set bits.SQL
mysql.bit_count(bytea) → integerCount the set bits.SQL
mysql.bit_count(text) → integerCount the set bits.SQL

ceil

SignaturePurposeSource definition
mysql.ceil(text) → bigintRound up to an integer.SQL

ceiling

SignaturePurposeSource definition
mysql.ceiling(text) → bigintRound up to an integer.SQL

conv

SignaturePurposeSource definition
mysql.conv(bigint, integer, integer) → textConvert a number between bases.SQL
mysql.conv(text, integer, integer) → textConvert a number between bases.SQL

floor

SignaturePurposeSource definition
mysql.floor(text) → bigintRound down to an integer.SQL

int_div

SignaturePurposeSource definition
mysql.int_div(mysql.hexlit, mysql.hexlit) → bigintCompute the integer quotient for MySQL DIV.SQL
mysql.int_div(mysql.hexlit, numeric) → bigintCompute the integer quotient for MySQL DIV.SQL
mysql.int_div(numeric, mysql.hexlit) → bigintCompute the integer quotient for MySQL DIV.SQL
mysql.int_div(numeric, numeric) → bigintCompute the integer quotient for MySQL DIV.SQL

log

SignaturePurposeSource definition
mysql.log(bigint) → numericCompute a logarithm.SQL
mysql.log(integer) → numericCompute a logarithm.SQL
mysql.log(numeric) → numericCompute a logarithm.SQL
mysql.log(smallint) → numericCompute a logarithm.SQL

log2

SignaturePurposeSource definition
mysql.log2(double precision) → numericCompute the base-two logarithm.SQL
mysql.log2(numeric) → numericCompute the base-two logarithm.SQL

mod

SignaturePurposeSource definition
mysql.mod(bigint, bigint) → bigintReturn the remainder of division.SQL
mysql.mod(bigint, text) → numericReturn the remainder of division.SQL
mysql.mod(integer, integer) → integerReturn the remainder of division.SQL
mysql.mod(integer, text) → numericReturn the remainder of division.SQL
mysql.mod(mysql."smallint", mysql."smallint") → mysql."smallint"Return the remainder of division.SQL
mysql.mod(mysql."smallint", text) → numericReturn the remainder of division.SQL
mysql.mod(numeric, numeric) → numericReturn the remainder of division.SQL
mysql.mod(numeric, text) → numericReturn the remainder of division.SQL
mysql.mod(text, bigint) → numericReturn the remainder of division.SQL
mysql.mod(text, integer) → numericReturn the remainder of division.SQL
mysql.mod(text, mysql."smallint") → numericReturn the remainder of division.SQL
mysql.mod(text, numeric) → numericReturn the remainder of division.SQL
mysql.mod(text, text) → numericReturn the remainder of division.SQL

rand

SignaturePurposeSource definition
mysql.rand() → numericGenerate a pseudorandom number.SQL
mysql.rand(bigint) → numericGenerate a pseudorandom number.SQL
mysql.rand(integer) → numericGenerate a pseudorandom number.SQL

round

SignaturePurposeSource definition
mysql.round(integer) → integerRound to the requested precision.SQL
mysql.round(integer, integer) → integerRound to the requested precision.SQL
mysql.round(numeric) → integerRound to the requested precision.SQL
mysql.round(numeric, integer) → numericRound to the requested precision.SQL
mysql.round(text) → numericRound to the requested precision.SQL
mysql.round(text, integer) → numericRound to the requested precision.SQL

sqrt

SignaturePurposeSource definition
mysql.sqrt(bigint) → numericCompute the square root.SQL
mysql.sqrt(integer) → numericCompute the square root.SQL
mysql.sqrt(numeric) → numericCompute the square root.SQL
mysql.sqrt(smallint) → numericCompute the square root.SQL

truncate

SignaturePurposeSource definition
mysql.truncate(numeric, integer) → numericTruncate a number to the requested decimal place.SQL