473,394 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Storing partial dates

I am creating my first mySQL database to store genealogy information and
would like fields for date of birth and date of death.

Unfortunately some older records are quite vague with only the year being
available in some cases. I am concerned that if I store only the year or
month & year where available then when the information is retrieved then
the missing information will be defaults which are incorrect.

For example if I store the date of birth as "March 1900" how can I avoid
this being retrieved as "1st March 1900"

Would it be best practice to store the day month & year in separate fields ?
--
Thanks

Murph
Jul 23 '05 #1
3 2110
Murphy wrote:
For example if I store the date of birth as "March 1900" how can I avoid
this being retrieved as "1st March 1900"
Would it be best practice to store the day month & year in separate

fields ?

NULL is sometimes used to indicate missing or unspecified information.
NULL exists in SQL because "no value" is different from zero or an empty
string, or some special date like 1-1-1900. Those values can have
significance, depending on the application. Like yours -- someone could
have a birthdate of 1-1-1900.

But NULL is a state of a field, not part of a field. So yes, I think
you should store the day, month, and year as separate fields in your
case, so that you can set any of the three to a NULL state.

Then you would need to write logic in your application to do an
appropriate thing with a NULL in any of these fields. For instance,
display only the year if the other two are NULL. Or giving the user a
means to to fill in the additional values if their genealogy research
reveals them later.

Regards,
Bill K.
Jul 23 '05 #2
"Murphy" <m@urphy.com> wrote in message
news:k4******************@news-server.bigpond.net.au...
I am creating my first mySQL database to store genealogy information and
would like fields for date of birth and date of death.


I did a genealogy database myself, and for this I created two date fields
for each case - one as a text field that stores what is typed in, and a
second that converts this to the actual closest date for sorting and
comparison purposes. So "March 1900" is coverted over to 1/1/1900 in the
actual date field, but the application displays the text field.
Jul 23 '05 #3
Ray Gurganus wrote:
"Murphy" <m@urphy.com> wrote in message
news:k4******************@news-server.bigpond.net.au...
I am creating my first mySQL database to store genealogy information and
would like fields for date of birth and date of death.


I did a genealogy database myself, and for this I created two date fields
for each case - one as a text field that stores what is typed in, and a
second that converts this to the actual closest date for sorting and
comparison purposes. So "March 1900" is coverted over to 1/1/1900 in the
actual date field, but the application displays the text field.


Excellent solution...

--
Thanks

Murph
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Angelos | last post by:
What do you think is the best way to store Dates into a database ? If you want to keep logs or buckups.... I am using date('dmYHis') but I doesn't work really well ... Is it better to use...
2
by: Robert | last post by:
I have no problem storing dates + times in a System.DateTime object. In addition, it's easy to output a Time as a string from an existing Date/Time. But I'm having trouble storing a time only. ...
1
by: Thomas R. Hummel | last post by:
Hello all, I have been working with several databases here that are basically data marts. A lot of the entities have an attribute that is a particular year and month. For example, a financial...
8
by: Zvonko | last post by:
Hi! I would like to get the clients date and time (his system time) and store it somewhere so I can use it in my code later. (insert it to database!). Any ideas Zvonko
10
by: IntraRELY | last post by:
Here is my code, but get errors: Dim installment = 1 Dim beginDate = "1/1/03" Dim endDate = "1/1/08" Dim dates(5) As Array While installment <= 5 endDate = DateAdd(DateInterval.Year, 1,...
7
by: fauxanadu | last post by:
Is it possible to store dates before 01/01/0100 A.D. (such as for as database storing world events would require) using MS Access? Verbose Explination I need to be able to store dates before...
10
by: mk | last post by:
Calvin Spealman wrote: Well, basically nothing except I need to remember I have to do that. Suppose one does that frequently in a program. It becomes tedious. I think I will define some helper...
1
by: nightscorpion | last post by:
Hello everyone. i have 2 dates given FromDate :1998-04-13T00:00:00 ToDate :1998-04-18T23:59:00 i would like to store these two days as single dates in the table in my db could...
4
by: John A Grandy | last post by:
What are some best practices for storing pure dates and pure times in .NET ? I notice that DateTime.TimeOfDay() returns type TimeSpan , which is certainly sufficient for storing pure times , but...
2
by: aeblank | last post by:
THE PROBLEM I'm running into performance issues generating and storing a randomly created graph in a SQL Server database. I have a T-SQL script that generates a graph, and then randomly connects the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.