• abs(x)返回x的绝对值
      1. select abs(-1), abs(1), abs(0);
      2. +---------+--------+--------+
      3. | abs(-1) | abs(1) | abs(0) |
      4. +---------+--------+--------+
      5. | 1 | 1 | 0 |
      6. +---------+--------+--------+
    • ceil(x)返回大于x的最小整数值
      select ceil(-5), ceil(5), ceil(-5.1), ceil(5.1);
      +----------+---------+------------+-----------+
      | ceil(-5) | ceil(5) | ceil(-5.1) | ceil(5.1) |
      +----------+---------+------------+-----------+
      |       -5 |       5 |         -5 |         6 |
      +----------+---------+------------+-----------+
      
    • floor(x)返回小于x的最大整数值
      select floor(-5), floor(5), floor(5.1), floor(-5.1);
      +-----------+----------+------------+-------------+
      | floor(-5) | floor(5) | floor(5.1) | floor(-5.1) |
      +-----------+----------+------------+-------------+
      |        -5 |        5 |          5 |          -6 |
      +-----------+----------+------------+-------------+
      
    • MOD(x,y)返回x/y的模。模数和被模数任意一个为null,结果就为null。
      select mod(10,2), mod(5,2), mod(2.5, 0.3), mod(null, 1), mod(1, null);
      +-----------+----------+---------------+--------------+--------------+
      | mod(10,2) | mod(5,2) | mod(2.5, 0.3) | mod(null, 1) | mod(1, null) |
      +-----------+----------+---------------+--------------+--------------+
      |         0 |        1 |           0.1 |         NULL |         NULL |
      +-----------+----------+---------------+--------------+--------------+
      
    • rand()返回0-1的随机值 ```sql select rand(); +—————————-+ | rand() | +—————————-+ | 0.947478930416963 | +—————————-+

    select ceil(rand()100); +—————————+ | ceil(rand()100) | +—————————+ | 80 | +—————————+

    
    
    - 
    `round(x, y)`返回参数x的四舍五入有y位小数的值
    ```sql
    select round(5.333, 2), round(5.335, 2), round(5.2), round(null), round(1, null);
    +-----------------+-----------------+------------+-------------+----------------+
    | round(5.333, 2) | round(5.335, 2) | round(5.2) | round(null) | round(1, null) |
    +-----------------+-----------------+------------+-------------+----------------+
    |            5.33 |            5.34 |          5 |        NULL |           NULL |
    +-----------------+-----------------+------------+-------------+----------------+
    
    • truncate(x, y)返回数字x截断为y位小数的结果。与round的区别,仅仅截断,没有四舍五入。
      select truncate(5.3333, 2), truncate(5.335, 2), truncate(null, 2), truncate(5.33, null);
      +---------------------+--------------------+-------------------+----------------------+
      | truncate(5.3333, 2) | truncate(5.335, 2) | truncate(null, 2) | truncate(5.33, null) |
      +---------------------+--------------------+-------------------+----------------------+
      |                5.33 |               5.33 |              NULL |                 NULL |