我有一个想帮助我解决的问题,它与数据库字段中数据类型的值有关.
>必须指定具有字段标识符id INT的字符或值的数量.
id INT UNSIGNED NOT NULL AUTO_INCREMENT
> id INT和id INT(11)有什么区别,必须建立多个值吗?
id INT UNSIGNED NOT NULL AUTO_INCREMENT
id(11) INT UNSIGNED NOT NULL AUTO_INCREMENT
>如果未指定任何值,则ID INT中的默认设置MySQL是什么?
>允许我加整数的最大位数是多少?
>在这种情况下,您必须使用INT
>在这种情况下,您应该使用BIGINT
示例:我将以一个新闻门户为例,该门户可能会吸引许多访问.
需要记录其访问全球新闻的次数,假设您的新闻年度被访问了999.999.999次,有点夸张了:),但是在这种情况下使用INT或BIGINT是有效的
非常感谢您的支持.
解决方法:
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.)
数据类型INT使用4个字节(从-2147483648到2147483647或从0到4294967295无符号),数据类型BIGINT使用8个字节(从-922337203685477575808到9223372036854775807或从0到18446744073709551615无符号).
因此,我认为您的问题的答案是:
>广告1)否.
>广告2)如上所述的显示.
>广告3)没有指定显示宽度.
>广告4)参见上文.
>广告5和6)最多2147483647,您可以使用INT,在此值以上,您必须使用无符号INT或BIGINT.
标签:mysql,database
来源: https://codeday.me/bug/20191027/1944926.html