Collections:
FORMAT() - Formatting Number to String
How to convert a number into a string in a given format using the FORMAT() function?
✍: FYIcenter.com
FORMAT(X, D, locale) is a MySQL built-in function that
converts a number into a string in a given format according
to the rounding rule and the specified locale standard.
For example:
SELECT FORMAT(12332.1,4), FORMAT(12332.1, 4, 'de_DE'); -- +-------------------+-----------------------------+ -- | FORMAT(12332.1,4) | FORMAT(12332.1, 4, 'de_DE') | -- +-------------------+-----------------------------+ -- | 12,332.1000 | 12.332,1000 | -- +-------------------+-----------------------------+ SHOW VARIABLES LIKE 'lc_time_names'; -- +---------------+-------+ -- | Variable_name | Value | -- +---------------+-------+ -- | lc_time_names | en_US | -- +---------------+-------+
Reference information of the FORMAT() function:
FORMAT(X, D, locale): str Formats the number X to a format like '#,###,###.##', rounded to D decimal places, and returns the result as a string. If D is 0, the result has no decimal point or fractional part. The optional third parameter enables a locale to be specified to be used for the result number's decimal point, thousands separator, and grouping between separators. Arguments, return value and availability: X: Required. The number to be converted. D: Required. The decimal place to round to. locale: Optional. Default is the system locale. int: Return value. The year week combination. Available since MySQL 4.
⇒ FORMAT_BYTES() - Formatting Bytes in Readable Units
⇐ FLOOR() - Flooring a Numeric Value
2023-11-18, 1255🔥, 0💬
Popular Posts:
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...
How To View Data Files in the Current Database in Oracle? If you want to get a list of all tablespac...
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL? When you enter DATETIM...
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...
How to download and install Microsoft .NET Framework Version 2.0 in SQL Server? .NET Framework Versi...