Database Design Problems (SQL)

Source: Internet
Author: User

I have encountered a problem in improving my own database tables over the past two days!

Data storage type problem: when I first set up a data center charging system, I didn't think so much about database design, and I thought about which data is used and what type is appropriate. Now I want to normalize the data,The data design of the system is so messy that a large system will not be maintained in the future..

The first is the date type. Previously, it was stored as a string type, but there is a date type in the database. Why not use it?

I encountered some problems when using it. Sometimes I only need year, month, and day, but the datetime type is strongly added with hour, minute, and second. In this way, I have to use function filtering every time to obtain a date or a time from a duplicate.

It seems that there is no good method, otherwise it will be a string access ···



I don't know how you handle it here?

Use a string?Is maintainability low?

Or is it used?Save the entire date. Do I need to use the function to retrieve the date?In this case, it seems a little troublesome and requires conversion every time you use it.

I still prefer to use the latter. After all, such development is unified, so you don't have to worry too much about it. It will become easier even if other people will maintain it in the future.

Inspiring discussion,Let's talk about our solutions.,Learn from each other !!!

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.