This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-21. For the latest, interactive version please visit https://mariadb.com/kb/.

FORMAT

Sintassi

FORMAT(X, D)

Spiegazione

Formatta il numero X perché corrisponda al formato '#,#,#.', arrotondato a D cifre decimali, e restituisce il risultato come stringa. Se D è 0, il risultato non ha il punto decimale nè la parte frazionale.

Esempi

MariaDB [(none)]> SELECT FORMAT(1234567890.09876543210, 4);
+-----------------------------------+
| FORMAT(1234567890.09876543210, 4) |
+-----------------------------------+
| 1,234,567,890.0988                |
+-----------------------------------+

MariaDB [(none)]> SELECT FORMAT(1234567.89, 4);
+-----------------------+
| FORMAT(1234567.89, 4) |
+-----------------------+
| 1,234,567.8900        |
+-----------------------+

MariaDB [(none)]> SELECT FORMAT(1234567.89, 0);
+-----------------------+
| FORMAT(1234567.89, 0) |
+-----------------------+
| 1,234,568             |
+-----------------------+
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.