Comparison of data typesChar represents a fixed length, and the longest n-word varchar represents the actual length of the data type, such as: if it is a char type, when you enter a character that is less than the length, then a space is added, but
if the setting in an item is varchar (So, of course, the English isSo what about Chinese?Utf-8 in Chinese is 3 bytesSo, does this varchar (50) have only 16 characters to save? No, this is the case with MySQL, but not after 5.0.MySQL varchar (50)
Summary of varchar types in MySQLToday to do a new project, the need for their own database design, found themselves on the use of varchar is not very familiar with, so review the data summarized if:variations of the 1.varchar typeThe maximum length
Charvarcharvarchar2 differences: 1. the length of CHAR is fixed, while the length of VARCHAR2 can be changed. For example, the storage string "abc", for CHAR (20 ), it indicates that the characters you store will occupy 20 bytes (including 17 null
If a varchar is set in an item (50)
Well, that's 50 for English.
So what about Chinese?
Utf-8 Chinese occupies 3 bytes
So, is this varchar (50) Only save 16 characters?
MySQL varchar (50) in both Chinese and English, there are 50.
MySQL5
Char is a fixed-length type, and varchar is a variable-length type. Their differences are as follows:In a char (m) data column, each value occupies M bytes. If the length of a data column is smaller than m, MySQL uses space characters on the right
Char varchar varchar2 the difference http://blog.csdn.net/honglei_zh/article/details/7172538Difference:1. The length of the char is fixed, and the length of the VARCHAR2 is changeable, for example, storing the string "abc", for Char (20), which
How to Use substring in oracle Database CONVERT (varchar (12), getdate (), 112), substringgetdate
SqlserverI often need to perform some time-type field conversions, but I don't quite remember it. So I collected the following
1, the logical meaning of varchar (N)Starting with MySQL4.1, n in varchar (n) refers to the maximum number of characters (characters) that can be stored in the field, not the number of bytes.
Whether it's a Chinese-English character or a number, or
1. Logic meaning of varchar (N)From MySQL4.1, N in varchar (N) indicates the maximum number of characters (characters) that can be stored in this field, not the number of bytes.Whether it is a Chinese character or a number, or a Chinese character,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.