对整数长度感到困惑。 [英] Confused on integer lengths.

查看:130
本文介绍了对整数长度感到困惑。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对整数长度的理解感到困惑。

int(255)是什么意思?

这意味着我可以输入数据库的数字数字可以包含255个数字或什么?帮助我。



我尝试过:



我有两个关于它意味着什么的想法,它的数字位数或数据的价值。

例如:int(255)=> 255或者是int(255)=> 1234123151232 ....

解决方案

没有我的直接帮助,因为如果你问这个问题,你就有一百个同一个国王的问题。



我的建议:通过阅读文档并遵循教程来正确学习语言。我知道这很无聊,但这是知识的唯一途径,没有捷径。

学会尽快使用谷歌。如果互联网上存在某些内容,Google就会知道。


这意味着是时候学习阅读文档了! :)





MySQL支持扩展,用于在类型的base关键字后面的括号中选择性地指定整数数据类型的显示宽度。例如,INT(4)指定显示宽度为四位的INT。

...

显示宽度不限制可以的值范围存储在列中。它也不会阻止比列显示宽度更宽的值正确显示。



并且:



类型: INT

最低价值: -2147483648

最高价值: 2147483647



即使 BIGINT 也不能存储255位数字!


I'm confused on the understanding of the integer lengths.
What does int(255) mean?
does that mean the numbers I can enter to the database numbers that can contain like 255 digits or what? Help me.

What I have tried:

I have two ideas on what it's suppose to mean, its either the number of digits or the value of a data.
example: int(255) => 255 or is it int(255) => 1234123151232....

解决方案

No direct help from me, because if you ask this, you have hundred of questions of the same king.

My advice: learn properly the language by reading documentation and follow tutorials. I know it is boring but it is the only way to knowledge, and there is no shortcut.
Learn to use Google as soon as possible. If something exist on internet, Google Know about it.


It means it's time to learn to read the documentation! :)


MySQL supports an extension for optionally specifying the display width of integer data types in parentheses following the base keyword for the type. For example, INT(4) specifies an INT with a display width of four digits.
...
The display width does not constrain the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly.


And:


Type: INT
Minimum value: -2147483648
Maximum value: 2147483647


Not even a BIGINT could store a number with 255 digits!


这篇关于对整数长度感到困惑。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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