Warning
SingleStore 9.0 gives you the opportunity to preview, evaluate, and provide feedback on new and upcoming features prior to their general availability. In the interim, SingleStore 8.9 is recommended for production workloads, which can later be upgraded to SingleStore 9.0.
FORMAT
On this page
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: February 27, 2023