Nothings gonna Change my love using MySQL date/time type

Source: Internet
Author: User
Tags time and date
Since he was the same team, I was very familiar with his "neat" approach, I also very much agree with his many points of view, but one of the most incomprehensible is that the design of the database will always avoid the use of date/time type. His approach is to set the time-related field to the INT (10) type and then store it with a UNIX timestamp. And I personally disagree with this approach:
First, the difference between type operations, such as Wildgoose, is essentially an operation between shaping (and this is a very large, length of 10). What's more, the time stamp is set to VARCHAR (10), and the resulting efficiency problem is self-evident.
As for the efficiency of time calculation and shaping calculation and even the calculation of strings, this article is very illustrative of the problem.
Secondly, it is the operational problem of logic. This is the advantage of using the time type, especially on projects that require high precision. such as the need for "the first one weeks of data" and "to obtain data from the database since the establishment of each Monday", such operations such as the use of Wildgoose Brother's practice is conceivable.
Finally, the intuitive problem is that it is understandable that our brains do not directly convert this large string of timestamps into date formats. In contrast, the direct use of the time type is significantly more intuitive (it is the time format itself).
And my current team is still using a similar approach. I have a similar technical details of the dispute for a long while, but because of the position and decision of the question, the team still can not adopt my opinion, very sorry.
MySQL is positioned as a quick and easy DBM, but on the other hand it can easily lead to a situation that will not go further. For this, we should pay attention to the details of each database design, a product constantly add new features to the end are application-oriented.
Finally, a manual of the official MySQL time and date function is attached.

The above describes the nothings gonna changes My love uses the MySQL date/time type, including nothings gonna change my content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.