简体   繁体   中英

How is MySQL char column size limit is calculated?

What is the actual size limit of char column in MySQL?
Suppose I have a word with 5 English characters, and another word with 5 Chinese characters, and char column with size limit of 5. Are both of the words can be stored in the column? Or does the Chinese characters need more space than English characters?

In short, CHAR(m) will hold m characters, irrespective of the number of bytes required in the column's character encoding.

Therefore, in your example, a CHAR(5) column can store any 5 characters in the column's character set, whether they are English, Chinese or a mix of the two. The number of bytes used to store the data may however vary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM