使用此varchar(50)数据类型输入多少个字符. [英] how many character enter with this varchar(50) datatype.

查看:418
本文介绍了使用此varchar(50)数据类型输入多少个字符.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友
我对varchar数据类型感到困惑.我所知道的是varchar()每个字符占用1个字节+额外的2个字节.为什么需要额外的2个字节.在varchar(50)数据类型中将存储多少个字符.

Hello friends
i am confused with varchar datatype. what i have known is varchar()take 1 byte for each character + extra 2 byte.why it takes extra 2 bytes. How many character will be stored in varchar(50) datatype.

推荐答案

为空字符``\ 0''额外保留2个字节
和varchar(50)将允许存储50个字符.
空字符"字节由SQL内部管理.
extra 2 bytes reserved for null character ''\0''
and varchar(50) will allow to store 50 characters.
''null character'' bytes are managed by SQL internally.


"var"位表示数据中的字符数不是固定的-最多可以为字节数最大限度地.通常,附加字节是当前使用的字节数的计数.

因此varchar(50)可以容纳0到50个字符,并且需要52个字节来存储.
The "var" bit means that the number of characters in the data is not fixed - it can be any number of bytes up to the maximum. The additional bytes are the count of the number of bytes currently used, generally.

So varchar(50) could hold 0 to 50 characters, and would take 52 bytes to store.


这篇关于使用此varchar(50)数据类型输入多少个字符.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆