Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Rounds and formats a number with thousands separators and a fixed-length decimal part.
FORMAT ( expression, precision )
String. The thousands separator is hard-coded to “,” and the decimal separator is “.”
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 |
+---------------------+