In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you about the difference between int (10) and char (10) and varchar (10) in mysql. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
1. First of all, the meaning is different. First, the 10 of int (10) indicates the length of the displayed data, not the size of the stored data.
The 10 of chart (10) and varchar (10) indicates the size of the stored data, that is, how many characters are stored.
For example:
A. int (10) 10 indicates the maximum display width. The maximum valid display width is 255. The display width is independent of the range of values contained in the storage size or type.
B. char (10) 10-bit fixed string with no more than 10 characters to fill in blanks
C. varchar (10) 10-bit variable string with no more than 10 characters to fill in blanks
There is also a difference between 2.char (10) and varchar (10). Char (10) means to store 10 characters of fixed length, and less than 10 characters are filled with spaces to take up more storage space, while varchar (10) means to store 10 characters of variable length, and the number of spaces is as many as one character, which is different from the space of char (10). The space of char (10) is not a character.
3.char access number is still much faster than varchar, because its length is fixed, convenient for program storage and search; but char also pays the price of space, because its length is fixed, so there will inevitably be extra space placeholders to occupy space, it can be said that space for time efficiency, and varchar is to space efficiency as the first.
The storage mode of 4.char is to occupy 1 byte for English characters (ASCII) and two bytes for a Chinese character, while the storage mode of varchar is to occupy 2 bytes for each English character and 2 bytes for Chinese characters, both of which are non-unicode character data.
Note: the above are personal opinions and are for reference only!
These are the differences between int (10) and char (10) and varchar (10) in mysql shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are 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.