FORMAT_NUMBER
Descriptionβ
Returns a formatted string using a unit symbol, UNITS: "K", "M", "B", "T", "Q"
Syntaxβ
FORMAT_NUMBER(<val>)
Parametersβ
Parameter | Description |
---|---|
<val> | The value is to be calculated with unit |
Return Valueβ
The formatted string using a unit symbol.
Exampleβ
SELECT format_number(123456.0);
+-----------------------------------------+
| format_number(cast(123456.0 as DOUBLE)) |
+-----------------------------------------+
| 123K |
+-----------------------------------------+
SELECT format_number(1000000.00);
+-------------------------------------------+
| format_number(cast(1000000.00 as DOUBLE)) |
+-------------------------------------------+
| 1M |
+-------------------------------------------+
select format_number(-1000000000000000);
+--------------------------------------------------+
| format_number(cast(-1000000000000000 as DOUBLE)) |
+--------------------------------------------------+
| -1Q |
+--------------------------------------------------+