![]() In the output, the Maxlen column shows the maximum number of bytes for each character. ![]() | binary | Binary pseudo charset | binary | 1 | | big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 | | ascii | US ASCII | ascii_general_ci | 1 | | armscii8 | ARMSCII -8 Armenian | armscii8_general_ci | 1 | | Charset | Description | Default collation | Maxlen | To find available character sets in the current database, you use the following statement: SHOW CHARACTER SET In such cases, the length of a string in character may be different from its length in bytes. In multi-byte character sets, such as UTF-8, MySQL represents characters using multiple bytes. For these character sets, the length of a string in characters is equal to its length in bytes. In a single-byte character set, MySQL represents each character using a single byte. MySQL supports various character sets, including single-byte and multi-byte character sets. Understanding character setsĬharacter sets define how MySQL store and represent characters in a database. Note that to get the number of characters of a string, you use the CHAR_LENGTH() function instead. Therefore, the result of the LENGTH() function is based on the current character set of the string. The LENGTH() function takes a string argument and returns its length measured in bytes. Here’s the basic syntax of the LENGTH() function: LENGTH(string) ![]() The LENGTH() function returns the length of a string measured in bytes. Summary: in this tutorial, you will learn about the MySQL LENGTH() function to get the length of strings in bytes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |