开发者

Why can't tinyint store more than the number 255 in MySQL?

If TINYINT can store three characters, for example, why can't it store up to t开发者_JAVA百科he number 999?


Because it takes only 8 bit and hence can encode no more than 2^8 = 256 values.

The three characters you see in something like '123' are the result of the binary to decimal conversion. You cannot store arbitrary 3 characters there.


It is 8 bits and can actually store a maximum value of 255. 8 bits have 256 possible states including zero.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜