CodesJava

Easy learning with example program codes

FORMAT() FUNCTION in MySQL

FORMAT() FUNCTION
The MySQL FORMAT function is used to format a number as a format of ‘#,###.##’. It also rounds the number to a certain number of decimal places, as specified. The various versions of MySQL supports the FORMAT function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

<Syntax:

FORMAT( number, decimal_places )

Parameters:
number: It is used to specify the number to format.
decimal_places: It is used to specify the number of decimal places for rounding.

Example 1:

mysql> SELECT FORMAT ( 3254.7698, 1);

Output:

3,254.8

Explanation:
The number is formatted.

Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status