round

description

Syntax

BIGINT round(DOUBLE x) 将x四舍五入后保留整数部分.

example

1. mysql> select round(2.4);
2. +------------+
3. | round(2.4) |
4. +------------+
5. |          2 |
6. +------------+
7. mysql> select round(2.5);
8. +------------+
9. | round(2.5) |
10. +------------+
11. |          3 |
12. +------------+
13. mysql> select round(-3.4);
14. +-------------+
15. | round(-3.4) |
16. +-------------+
17. |          -3 |
18. +-------------+
19. mysql> select round(-3.5);
20. +-------------+
21. | round(-3.5) |
22. +-------------+
23. |          -4 |
24. +-------------+

keywords

1. ROUND