Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4237180
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:44:22+00:00 2026-05-21T02:44:22+00:00

Now there are three options that I have in my mind. 1st -> four

  • 0

Now there are three options that I have in my mind.

1st -> four columns(date, month, year, day) => 28, 03, 2011, 1
I can easily search and modify these columns without additional learning of mysql dates.

2nd -> one Date column(dd-mm-yyyy) => 28-03-2011
This only requires one column, easier to manage as there is only one WHERE parameter for searching dates. But I dont know how can I search all the records for say a particular day. Lets say all the data for all the mondays in the past or all the data for all the 28ths.

3rd -> two columns(unix timestamp for todays date, day) => 1827328721, 1
Now, here I can store store the data as a time stamp and easily do searches and comparisons by simple getting a date and then turning it into a unix timestamp and then using that in the sql. For day I can use the day column.

Now the questions are:

  1. How does the performance differ between these methods?
  2. How would the queries for selects, inserts and updates be constructed for these different proposed solutions?
  3. Which one is best in your opinion and why?

Please answer all the three questions thoroughly. Because I can not find this information elsewhere, and I know stack overflow has brilliant programmers who can answer this very coherently. This question will not only benefit a newbie like me but think of all the other newbies who could use this for reference.

Thanking in advance to Stack overflow Community.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:44:23+00:00Added an answer on May 21, 2026 at 2:44 am

    How does the performance differ between these methods?

    This will vary greatly based on what type of application is using the database.

    The first method could be considered a de-normalized approach, but this could be a good idea if the data is used for an OLAP application. For example, if you frequently need to gather massive sets of data for a specific day of the month, then this de-normalization could be justified… otherwise, it would just be a waste of storage and needlessly complex.

    The same with the third option… it’s just a de-normalized representation of the date; it could be justified in very limited uses, but usually it would be a bad idea.

    –EDIT–

    By De-normalized, I mean the following…

    Let’s say you have a record with the following fields…

    Date       Day    Month    Year
    3/28/2011  28     3        2011
    

    And lets say you need to change the day from the 28th to the 29th. In this case, you need to update two fields, both the Date and the Day field… instead of just one. If you always remember to update both, then it isn’t a huge problem. But if you don’t, over time you end up with something like the following.

    Date       Day    Month    Year
    3/28/2011  29     2        2009
    

    So what’s the actual date? By storing the information in a single place, you eliminate the possibility of inconsistencies in the data.

    — END EDIT–

    Which one is best in your opinion and why?

    Unless your database is used for OLAP… I would consider the second option to be the best.

    How would the queries for selects, inserts and updates be
    constructed for these different
    proposed solutions?

    For the preferred, second option, this is trivial.

    — SECOND EDIT —

    You can pass in the date as a string, and MySQL will parse it according. The date format is “YYYY-MM-DD HH:mm:SS”, but you don’t have to specify the time if you don’t care to store it.

    INSERT INTO tablename (date) VALUES ('2011-3-28')
    

    Or, if you just want to add the current date…

    INSERT INTO tablename (date) VALUES (CURDATE() )
    

    — END EDIT —

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are three UIView *view1,view2 , view3; Now, view1 have to be shown at
Now there is a subject that could be taken many ways. Hopefully I will
From the .net 4.0 previews I have read until now there has been lots
I have data like below AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE Now there is a
We have got a custom MembershipProvider in ASP.NET . Now there are 2 possible
I have a NSMutableArray: NSMutableArray *temp = //get list from somewhere. Now there is
I'm currently writing a ToDo-Script for a project i have running. Now there is
I have a legacy web application that was written long before there were even
I have three different models that will be involved with this. I am trying
Since Object Initializers are very similar to JSON, and now there are Anonymous Types

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.