MySQL VARCHAR大小? [英] MySQL VARCHAR size?
本文介绍了MySQL VARCHAR大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道,如果我有一个200个字符的VARCHAR,并且我放置了一个100个字符的字符串,它将使用200个字节还是仅使用字符串的实际大小?
I'm wondering, if I have a VARCHAR of 200 characters and that I put a string of 100 characters, will it use 200 bytes or it will just use the actual size of the string?
推荐答案
100个字符.
这是varchar
中的 var (变量):您仅存储输入的内容(以及另外2个字节以存储长度为65535的长度)
This is the var (variable) in varchar
: you only store what you enter (and an extra 2 bytes to store length upto 65535)
如果是char(200)
,则您将始终存储200个字符,并用100个空格填充
If it was char(200)
then you'd always store 200 characters, padded with 100 spaces
请参阅文档:"CHAR和VARCHAR类型"
这篇关于MySQL VARCHAR大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文