The format () function is used to format a number of x:###,###,##### truncated to D decimal places in the following format. The following example shows how to use and output the format () function:
The code is as follows |
Copy Code |
Mysql>select FORMAT (423423234.65434453,2); +---------------------------------------------------------+ | FORMAT (423423234.65434453,2) | +---------------------------------------------------------+ | 423,423,234.65 | +---------------------------------------------------------+ 1 row in Set (0.00 sec) |
The format function of MySQL, which can format data as integers or floating-point numbers.
code is as follows |
copy code |
mysql> Select Format (100.31111,2); +---------------------+ | format (100.31111,2) | +---------------------+ | 100.31 | +---------------------+ 1 row in Set (0.00 sec) mysql> Select Format (100.31111,0); +------- --------------+ | format (100.31111,0) | +---------------------+ | 100 | +---------------------+ 1 row in Set (0.00 sec) mysql> Select Format (100.51111,0); +------- --------------+ | format (100.51111,0) | +---------------------+ | 101 | +---------------------+ 1 row in Set (0.00 sec) |