• <legend id='OdKNP'><style id='OdKNP'><dir id='OdKNP'><q id='OdKNP'></q></dir></style></legend>

          <bdo id='OdKNP'></bdo><ul id='OdKNP'></ul>

        <tfoot id='OdKNP'></tfoot>
      1. <i id='OdKNP'><tr id='OdKNP'><dt id='OdKNP'><q id='OdKNP'><span id='OdKNP'><b id='OdKNP'><form id='OdKNP'><ins id='OdKNP'></ins><ul id='OdKNP'></ul><sub id='OdKNP'></sub></form><legend id='OdKNP'></legend><bdo id='OdKNP'><pre id='OdKNP'><center id='OdKNP'></center></pre></bdo></b><th id='OdKNP'></th></span></q></dt></tr></i><div id='OdKNP'><tfoot id='OdKNP'></tfoot><dl id='OdKNP'><fieldset id='OdKNP'></fieldset></dl></div>

        <small id='OdKNP'></small><noframes id='OdKNP'>

        MySQL 中的类型:BigInt(20) 与 Int(20)

        时间:2023-08-17
        <legend id='Yg6rc'><style id='Yg6rc'><dir id='Yg6rc'><q id='Yg6rc'></q></dir></style></legend>

            <small id='Yg6rc'></small><noframes id='Yg6rc'>

              • <bdo id='Yg6rc'></bdo><ul id='Yg6rc'></ul>
              • <tfoot id='Yg6rc'></tfoot>

                  <tbody id='Yg6rc'></tbody>
                <i id='Yg6rc'><tr id='Yg6rc'><dt id='Yg6rc'><q id='Yg6rc'><span id='Yg6rc'><b id='Yg6rc'><form id='Yg6rc'><ins id='Yg6rc'></ins><ul id='Yg6rc'></ul><sub id='Yg6rc'></sub></form><legend id='Yg6rc'></legend><bdo id='Yg6rc'><pre id='Yg6rc'><center id='Yg6rc'></center></pre></bdo></b><th id='Yg6rc'></th></span></q></dt></tr></i><div id='Yg6rc'><tfoot id='Yg6rc'></tfoot><dl id='Yg6rc'><fieldset id='Yg6rc'></fieldset></dl></div>
                  本文介绍了MySQL 中的类型:BigInt(20) 与 Int(20)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想知道 BigIntMediumIntInt 之间的区别...更大的数字;但是,我可以制作一个 Int(20) 或一个 BigInt(20) 并且看起来它不一定与大小有关.

                  I was wondering what the difference between BigInt, MediumInt, and Int are... it would seem obvious that they would allow for larger numbers; however, I can make an Int(20) or a BigInt(20) and that would make seem that it is not necessarily about size.

                  一些见解会很棒,只是有点好奇.我一直在使用 MySQL 一段时间,并在选择类型时尝试应用业务需求,但我从未理解这方面.

                  Some insight would be awesome, just kind of curious. I have been using MySQL for a while and trying to apply business needs when choosing types, but I never understood this aspect.

                  推荐答案

                  参见 http://dev.mysql.com/doc/refman/8.0/en/numeric-types.html

                  • INT 是一个四字节的有符号整数.

                  • INT is a four-byte signed integer.

                  BIGINT 是一个八字节的有符号整数.

                  BIGINT is an eight-byte signed integer.

                  它们每个接受的值都不能多于可以存储在各自字节数中的值.这意味着 INT 中有 232 个值,BIGINT 中有 264 个值.

                  They each accept no more and no fewer values than can be stored in their respective number of bytes. That means 232 values in an INT and 264 values in a BIGINT.

                  INT(20)BIGINT(20) 中的 20 几乎没有任何意义.这是显示宽度的提示.它与存储无关,也与列将接受的值范围无关.

                  The 20 in INT(20) and BIGINT(20) means almost nothing. It's a hint for display width. It has nothing to do with storage, nor the range of values that column will accept.

                  实际上,它只影响 ZEROFILL 选项:

                  Practically, it affects only the ZEROFILL option:

                  CREATE TABLE foo ( bar INT(20) ZEROFILL );
                  INSERT INTO foo (bar) VALUES (1234);
                  SELECT bar from foo;
                  
                  +----------------------+
                  | bar                  |
                  +----------------------+
                  | 00000000000000001234 |
                  +----------------------+
                  

                  对于 MySQL 用户来说,看到 INT(20) 并假设它是一个大小限制,类似于 CHAR(20),这是一个常见的混淆源.事实并非如此.

                  It's a common source of confusion for MySQL users to see INT(20) and assume it's a size limit, something analogous to CHAR(20). This is not the case.

                  这篇关于MySQL 中的类型:BigInt(20) 与 Int(20)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MySQL:如何重置或更改 MySQL 根密码? 下一篇:MySQL 从 CSV 数据加载 NULL 值

                  相关文章

                  最新文章

                        <bdo id='xCmzZ'></bdo><ul id='xCmzZ'></ul>
                    1. <i id='xCmzZ'><tr id='xCmzZ'><dt id='xCmzZ'><q id='xCmzZ'><span id='xCmzZ'><b id='xCmzZ'><form id='xCmzZ'><ins id='xCmzZ'></ins><ul id='xCmzZ'></ul><sub id='xCmzZ'></sub></form><legend id='xCmzZ'></legend><bdo id='xCmzZ'><pre id='xCmzZ'><center id='xCmzZ'></center></pre></bdo></b><th id='xCmzZ'></th></span></q></dt></tr></i><div id='xCmzZ'><tfoot id='xCmzZ'></tfoot><dl id='xCmzZ'><fieldset id='xCmzZ'></fieldset></dl></div>
                    2. <small id='xCmzZ'></small><noframes id='xCmzZ'>

                    3. <legend id='xCmzZ'><style id='xCmzZ'><dir id='xCmzZ'><q id='xCmzZ'></q></dir></style></legend>
                      <tfoot id='xCmzZ'></tfoot>