### 数学函数

abs(double a)

acos(double a)

asin(double a)

atan(double a)

bin(bigint a)

mysql> select bin(10);+---------+| bin(10) |+---------+| 1010    |+---------+1 row in set (0.01 sec)

ceil(double a)

ceiling(double a)

dceil(double a)

conv(bigint num, int from_base, int to_base)

conv(string num,int from_base, int to_base)

mysql> select conv(64,10,8);+-----------------+| conv(64, 10, 8) |+-----------------+| 100             |+-----------------+1 row in set (0.01 sec)
mysql> select cast(conv('fe', 16, 10) as int) as "transform_string_to_int";+-------------------------+| transform_string_to_int |+-------------------------+|                     254 |+-------------------------+1 row in set (0.00 sec)

cos(double a)

degrees(double a)

e()

exp(double a)

dexp(double a)

floor(double a)

dfloor(double a)

fmod(double a, double b)

fmod(float a, float b)

mysql> select fmod(10,3);+-----------------+| fmod(10.0, 3.0) |+-----------------+|               1 |+-----------------+1 row in set (0.01 sec)
mysql> select fmod(5.5,2);+----------------+| fmod(5.5, 2.0) |+----------------+|            1.5 |+----------------+1 row in set (0.01 sec)

greatest(bigint a[, bigint b …​])

greatest(double a[, double b …​])

greatest(decimal(p,s) a[, decimal(p,s) b …​])

greatest(string a[, string b …​])

greatest(timestamp a[, timestamp b …​])

hex(bigint a)

hex(string a)

mysql> select hex('abc');+------------+| hex('abc') |+------------+| 616263     |+------------+1 row in set (0.01 sec)
mysql> select unhex(616263);+---------------+| unhex(616263) |+---------------+| abc           |+---------------+1 row in set (0.01 sec)

least(bigint a[, bigint b …​])

least(double a[, double b …​])

least(decimal(p,s) a[, decimal(p,s) b …​])

least(string a[, string b …​])

least(timestamp a[, timestamp b …​])

ln(double a)

dlog1(double a)

log(double base, double a)

log10(double a)

dlog10(double a)

log2(double a)

mod(numeric_type a, same_type b)

mysql> select mod(10,3);+------------+| mod(10, 3) |+------------+|          1 |+------------+1 row in set (0.01 sec)
mysql> select mod(5.5,2);+-------------+| mod(5.5, 2) |+-------------+|         1.5 |+-------------+1 row in set (0.01 sec)

negative(int a)

negative(double a)

pi()

pmod(int a, int b)

pmod(double a, double b)

positive(int a)

pow(double a, double p)

power(double a, double p)

rand()

rand(int seed)

random()

random(int seed)

round(double a)

round(double a, int d)

mysql> select round(100.456, 2);+-------------------+| round(100.456, 2) |+-------------------+|            100.46 |+-------------------+1 row in set (0.02 sec)

sign(double a)

sin(double a)

sqrt(double a)

tan(double a)

unhex(string a)

mysql> select hex('abc');+------------+| hex('abc') |+------------+| 616263     |+------------+1 row in set (0.01 sec)
mysql> select unhex(616263);+---------------+| unhex(616263) |+---------------+| abc           |+---------------+1 row in set (0.01 sec)