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

      <legend id='BhWdD'><style id='BhWdD'><dir id='BhWdD'><q id='BhWdD'></q></dir></style></legend>
      <tfoot id='BhWdD'></tfoot>

    1. <small id='BhWdD'></small><noframes id='BhWdD'>

        <bdo id='BhWdD'></bdo><ul id='BhWdD'></ul>
    2. mysql 数据类型仅存储月份和年份

      mysql datatype to store month and year only(mysql 数据类型仅存储月份和年份)

      <tfoot id='c4pxV'></tfoot>

      <legend id='c4pxV'><style id='c4pxV'><dir id='c4pxV'><q id='c4pxV'></q></dir></style></legend>
          • <bdo id='c4pxV'></bdo><ul id='c4pxV'></ul>

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

              <i id='c4pxV'><tr id='c4pxV'><dt id='c4pxV'><q id='c4pxV'><span id='c4pxV'><b id='c4pxV'><form id='c4pxV'><ins id='c4pxV'></ins><ul id='c4pxV'></ul><sub id='c4pxV'></sub></form><legend id='c4pxV'></legend><bdo id='c4pxV'><pre id='c4pxV'><center id='c4pxV'></center></pre></bdo></b><th id='c4pxV'></th></span></q></dt></tr></i><div id='c4pxV'><tfoot id='c4pxV'></tfoot><dl id='c4pxV'><fieldset id='c4pxV'></fieldset></dl></div>
                <tbody id='c4pxV'></tbody>
              • 本文介绍了mysql 数据类型仅存储月份和年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在编写一个 php 应用程序,它将在 MySQL 关系数据库中存储 STUDENT 数据.我试图找到最好的方式/数据类型来存储没有一天的月份和年份.我不知道我是否应该将它存储为 DATE 并以某种方式使用 php 将这一天存储为第 1 天,还是使用我目前不熟悉的其他数据类型.理想情况下,我不想存储一天,因为这一天不会总是相同的,如果将来一天发生变化,则需要更改 php 源代码.

                I'm writing a php application that will store STUDENT data in a MySQL relational database. I'm trying to find the best way/datatype to store a month and year together without the day. I don't know whether I should just store it as a DATE and use php someway to just store the day as the 1st or use a different datatype that I'm not currently familiar with. Ideally, I do not want to store a day, because the day will not always be the same and would require changing php source code if the day changed in the future.

                为了更多的背景信息,我正在存储一个 STUDENT 的 INTENT_TO_GRAD.客户似乎只想将此信息作为报告的参考或视觉效果,而不是将其用于数据操作.换句话说,此数据的唯一功能要求是在报告中显示.

                Just for more background info, I'm storing a STUDENT's INTENT_TO_GRAD. The client seems to only want this information as a reference or a visual for a report as opposed to using it for data manipulation. In other words, the only functional requirement for this data is to be displayed in a report.

                推荐答案

                何必呢?只需将它存储为一个完整的日期(也许总是使用第一个作为日期)并使用数据库函数 MONTH()YEAR() 如果您只需要其中的一部分.这使得使用该字段变得更加容易,因为您仍然可以进行范围查询等.

                Why bother? Just store it as a complete date (perhaps always using the first as the day) and use the database functions MONTH() and YEAR() if you only need part of it. This makes using that field much easier as you can still do range queries, etc.

                这篇关于mysql 数据类型仅存储月份和年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                SQL query to group by day(按天分组的 SQL 查询)
                What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
              • <tfoot id='0CdD1'></tfoot>

                  • <bdo id='0CdD1'></bdo><ul id='0CdD1'></ul>
                  • <legend id='0CdD1'><style id='0CdD1'><dir id='0CdD1'><q id='0CdD1'></q></dir></style></legend>

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

                    <small id='0CdD1'></small><noframes id='0CdD1'>