<legend id='l2776'><style id='l2776'><dir id='l2776'><q id='l2776'></q></dir></style></legend>

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

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

      <tfoot id='l2776'></tfoot>

      1. 常见的 MySQL 字段及其相应的数据类型

        Common MySQL fields and their appropriate data types(常见的 MySQL 字段及其相应的数据类型)
          <legend id='kNc4D'><style id='kNc4D'><dir id='kNc4D'><q id='kNc4D'></q></dir></style></legend>
              <tbody id='kNc4D'></tbody>

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

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

                  <tfoot id='kNc4D'></tfoot>
                1. 本文介绍了常见的 MySQL 字段及其相应的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在建立一个非常小的 MySQL 数据库,用于存储名字、姓氏、电子邮件和电话号码,并且正在努力为每个字段找到完美"的数据类型.我知道没有完美的答案,但是对于诸如此类的常用领域,必须有某种通用约定.例如,我确定一个未格式化的美国电话号码太大而不能存储为 unsigned int,它必须至少是一个 bigint.

                  I am setting up a very small MySQL database that stores, first name, last name, email and phone number and am struggling to find the 'perfect' datatype for each field. I know there is no such thing as a perfect answer, but there must be some sort of common convention for commonly used fields such as these. For instance, I have determined that an unformatted US phone number is too big to be stored as an unsigned int, it must be at least a bigint.

                  因为我相信其他人可能会觉得这很有用,所以我不想将我的问题仅限于我上面提到的领域.

                  Because I am sure other people would probably find this useful, I dont want to restrict my question to just the fields I mentioned above.

                  哪些数据类型适合常见的数据库字段?电话号码、电子邮件和地址等字段?

                  What datatypes are appropriate for common database fields? Fields like phone number, email and address?

                  推荐答案

                  有人会发布比这更好的答案,但只是想说明我个人永远不会在任何类型的整数字段中存储电话号码,主要是因为:

                  Someone's going to post a much better answer than this, but just wanted to make the point that personally I would never store a phone number in any kind of integer field, mainly because:

                  1. 你不需要用它做任何算术运算,并且
                  2. 迟早有人会尝试(做类似的事情)在他们的区号周围加上括号.

                  但总的来说,我似乎几乎只使用:

                  In general though, I seem to almost exclusively use:

                  • INT(11) 用于 ID 或引用另一个 ID 的任何内容
                  • 时间戳的日期时间
                  • VARCHAR(255) 用于保证少于 255 个字符的任何内容(页面标题、名称等)
                  • 几乎所有其他内容的文本.

                  当然也有例外,但我发现这涵盖了大多数可能性.

                  Of course there are exceptions, but I find that covers most eventualities.

                  这篇关于常见的 MySQL 字段及其相应的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Import CSV to Update rows in table(导入 CSV 以更新表中的行)
                  Importing MaxMind#39;s GeoLite2 to MySQL(将 MaxMind 的 GeoLite2 导入 MySQL)
                  How to save a Google maps overlay shape in the database?(如何在数据库中保存谷歌地图叠加形状?)
                  Is there a performance hit using decimal data types (MySQL / Postgres)(使用十进制数据类型(MySQL/Postgres)是否会影响性能)
                  MySQL truncates concatenated result of a GROUP_CONCAT function(MySQL 截断 GROUP_CONCAT 函数的连接结果)
                  How to reduce size of SQL Server table that grew from a datatype change(如何减少因数据类型更改而增长的 SQL Server 表的大小)
                  <legend id='2MP9U'><style id='2MP9U'><dir id='2MP9U'><q id='2MP9U'></q></dir></style></legend>

                      • <i id='2MP9U'><tr id='2MP9U'><dt id='2MP9U'><q id='2MP9U'><span id='2MP9U'><b id='2MP9U'><form id='2MP9U'><ins id='2MP9U'></ins><ul id='2MP9U'></ul><sub id='2MP9U'></sub></form><legend id='2MP9U'></legend><bdo id='2MP9U'><pre id='2MP9U'><center id='2MP9U'></center></pre></bdo></b><th id='2MP9U'></th></span></q></dt></tr></i><div id='2MP9U'><tfoot id='2MP9U'></tfoot><dl id='2MP9U'><fieldset id='2MP9U'></fieldset></dl></div>
                      • <tfoot id='2MP9U'></tfoot>
                          <tbody id='2MP9U'></tbody>
                          <bdo id='2MP9U'></bdo><ul id='2MP9U'></ul>

                          <small id='2MP9U'></small><noframes id='2MP9U'>