MySQL INT 含义 [英] MySQL INT meaning

查看:34
本文介绍了MySQL INT 含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果我取值为 8 的 INT,这是否意味着我只能从 1 到 99999999 或从 1 到 4294967295 UNSIGNED?

I was wondering if I take a INT with a value of 8, does that mean that I can only go from 1 to 99999999 or from 1 to 4294967295 UNSIGNED ?

推荐答案

文档似乎很清楚这一点:

The documentation seems pretty clear about this:

数字类型属性

MySQL 支持可选地指定显示的扩展base 关键字后面括号中整数数据类型的宽度对于类型.例如,INT(4) 指定一个带有显示的 INT四位数的宽度.这个可选的显示宽度可以由显示宽度小于通过用空格左填充为列指定的宽度.(那即,此宽度存在于结果集返回的元数据中.是否使用取决于应用程序.)

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. This optional display width may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. (That is, this width is present in the metadata returned with result sets. Whether it is used or not is up to the application.)

显示宽度不限制可以显示的值的范围存储在列中.它也不会阻止比列宽的值显示宽度无法正确显示.例如,一列指定为 SMALLINT(3) 的通常 SMALLINT 范围为 -32768 到32767,超出三位数字允许范围的值是以三位以上的数字完整显示.

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. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range permitted by three digits are displayed in full using more than three digits.

http://dev.mysql.com/doc/refman/5.5/en/numeric-types.html

这篇关于MySQL INT 含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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