Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
FORMAT
On this page
The FORMAT() function rounds and formats a number with thousands separators and a fixed-length decimal part.
Syntax
FORMAT ( expression, precision )
Arguments
-
expression: any valid numeric expression.
-
precision: the number of digits after the decimal to pad or round to.
Return Type
String.,
and the decimal separator is .
Examples
SELECT FORMAT(1234.565, 2);
+---------------------+
| FORMAT(1234.565, 2) |
+---------------------+
| 1,234.57 |
+---------------------+SELECT FORMAT(1234.56499, 2);
+------------------------+
| FORMAT(1234.561499, 2) |
+------------------------+
| 1,234.56 |
+------------------------+SELECT FORMAT(1234.567, 0);
+---------------------+
| FORMAT(1234.567, 0) |
+---------------------+
| 1,235 |
+---------------------+Last modified: