MySQL Mysql中int(10)的最大大小是多少

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10879345/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:38:27  来源:igfitidea点击:

What is the maximum size of int(10) in Mysql

asp.netmysql

提问by Manoj Nayak

In my database I have declared a variable of datatype Int(10). If I type a number in a textbox in my web page, that number is stored in a variable whose largest value can be Int(10)in Mysql. If I type a very large number in the textbox it is giving IndexOutofRangeException.

在我的数据库中,我声明了一个 datatype 变量Int(10)。如果我在网页的文本框中键入一个数字,该数字将存储在一个变量中,该变量的最大值可以Int(10)在 Mysql 中。如果我在文本框中键入一个非常大的数字,它会给出IndexOutofRangeException.

So I am planning to use the maximumlengthproperty of text box. What is the maximum number that can be stored in a variable of type Int(10)in mysql?

所以我打算使用maximumlength文本框的属性。Int(10)mysql中类型变量可以存储的最大数量是多少?

回答by ypercube??

INT(10)means you probably defined it as INT UNSIGNED.

INT(10)意味着您可能将其定义为INT UNSIGNED.

So, you can store numbers from 0up to 4294967295(note that the maximum value has 10 digits, so MySQL automatically added the (10)in the column definition which (10) is just a format hint and nothing more. It has no effect on how big number you can store).

所以,你可以存储从0up 到的数字4294967295(注意最大值有 10 位,所以 MySQL 自动(10)在列定义中添加了(10)只是一个格式提示而已。它对你的数字有多大没有影响可以存储)。

You can use BIGINT UNSIGNEDif you want to store bigger values. See the MySQL docs: Integer Types (Exact Value)

BIGINT UNSIGNED如果要存储更大的值,可以使用。请参阅 MySQL 文档:整数类型(精确值)

回答by Andrius Naru?evi?ius

An unsigned int has the max value of 4294967295 no matter if its INT(1) or int(10) and will use 4 bytes of data.

无符号整数的最大值为 4294967295,无论是 INT(1) 还是 int(10),都将使用 4 个字节的数据。

as stated here.

如规定在这里

回答by Divyansh Chaudhary

Just use BigInt Instead of Int in Mysql and if you want explanation in brief then goto

只需在 Mysql 中使用 BigInt 而不是 Int ,如果您想简要说明,请转到

MySQL DataTypes

MySQL 数据类型