1 1、取整函数:round(X)(遵循四舍五入)
2 select round(3.1415926) from table --3
3 select round(3.5) from table --4
4
5 2、指定精度取整函数: round(X,Y)(遵循四舍五入)
6 select round(3.14159,3) from table --3.142
7 select round(3.14123,3) from table --3.141
8
9 3、向下取整函数: floor(X)
10 select floor(3.6) from table --3
11 select floor(3.3) from table --3
12
13 4、向上取整函数: ceiling(X)
14 select ceiling(3.6) from table --4
15 select ceiling(3.3) from table --4
16
17 5、取随机数函数: rand(X)(返回一个0到1范围内的随机数)
18 select rand() from table --0.222121323242
19
20 6、取随机数函数: rand(X)(重复执行结果相同:返回一个稳定的随机数序列)
21 select rand(100) from table --0.6841454782373
22
23 7、自然指数函数: exp(X)(返回e的X次方)
24 select exp(2) from table --e*e
25
26 8、以10为底对数函数: log10(X)(返回以10为底的X的对数)
27 select log10(100) from table --2
28
29 9、以2为底对数函数: log2(X)(返回以2为底的X的对数)
30 select log2(8) from table --3
31
32 10、对数函数: log(X,Y)(返回以X为底的y的对数:2的3次方=8)
33 select log(2,8) from table --3
34
35 11、幂运算函数: pow(X,Y)/power(X,Y)(返回X的Y次幂)
36 select pow(2,4) from table --16
37
38 12、开平方函数: sqrt(X)(返回X的平方根)
39 select sqrt(16) from table --4
40
41 13、二进制函数: bin(X)(返回X的二进制表示)
42 select bin(7) from table --111
43
44 14、十六进制函数: hex(X)(返回X的十六进制表示)
45 select hex('ab') from table --6162
46
47 15、反转十六进制函数: unhex(X)
48 select hex('6162') from table --ab
49
50 16、进制转换函数: conv(X,Y,Z)(将数值X从Y进制转化到Z进制)
51 select conv(17,10,2) from table --10001
52
53 17、绝对值函数: abs(X)(返回X的绝对值)
54 select abs(-111.9) from table --111.9
55 select abs(111.9) from table --111.9
56
57 18、正取余函数: pmod(X,Y)(返回X除以Y的余数)
58 select pmod(9,4) from table --1
59 select pmod(-9,4) from table --3
60
61 19、正弦函数: sin(X)(返回X的正弦值)
62 select sin(0.8) from table --0.7173560908995228
63
64 20、反正弦函数: asin(X)(返回X的反正弦值)
65 select asin(0.7173560908995228) from table --0.8
66
67 21、余弦函数: cos(X)(返回X的余弦值)
68 select cos(0.9) from table --0.6216099682706644
69
70 22、反余弦函数: acos(X)(返回X的反余弦值)
71 select cos(0.6216099682706644) from table --0.9