In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you mysql how to find the length of the data, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
Mysql data length method: 1, use the "LENGTH" function to get the string length, syntax such as "SELECT LENGTH ('character')"; 2, through the "CHAR_LENGTH" function to view the string length, syntax such as "SELECT CHAR_LENGTH ('character')".
MySql calculates the length of the field
User account has useful Chinese characters. Find all accounts that contain Chinese characters.
SELECT member_name FROM table_member WHERE length (member_name)! = char_length (member_name) LENGTH
The "LENGTH" function in mysql is a built-in function to get the length of a string.
CHAR_LENGTH
Another function that looks at the string length in the mysql built-in function is "CHAR_LENGTH". The difference between the two functions is:
LENGTH: a Chinese character is counted as three characters, and a number or letter as a character.
CHAR_LENGTH: whether a Chinese character or a number or a letter is a character
Example
Chinese characters
SELECT LENGTH ('character'); output: 6SELECT CHAR_LENGTH ('character'); output: 2
Character
SELECT LENGTH ('abc'); output: 3SELECT CHAR_LENGTH (' abc'); output: 3 command units, one Chinese character, one numeric or letter example char_length character 11char_length (str) lengthByte31length (str) bit_lengthbit248length (str)
When the length of the string exceeds the maximum length defined by max_allowed_packet, the above function returns NULL.
Max_allowed_packet generally defaults to 4MB (5.6.5 and below is 1MB)
These are all the contents of how mysql calculates the length of the data. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.