473,786 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2142
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
1763
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 date(U) ? Any suggestions ? And if you can let me know how you can Display that date back in the Screen
2
1816
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. Is there any way to store only a time without the date portion (like 3:00 am) in this data structure? Or, if not, is there another data structure that would be preferable? Thanks
1
371
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 transaction may be posted for a particular month, regardless of the actual date on which it occurred. In this system, these year/month combinations have typically been stored as integers of the form YYYYMM. My question is, how have others stored...
8
3376
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
7148
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, beginDate) dates.SetValue(couponEndDate, installment) installment = installment + 1
7
3254
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 100CE in a date field. This is for a world history database that I am building. I am currently storing dates in a database as unformatted text (14 characters: mm/dd/yyyy/. This requires using alot of extra VBA code to validate the dates to ensure...
10
1506
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 function then: .... fundict = newfun ....
1
1504
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 anyone suggest me how to store single dates in the db? ie FromDate :1998-04-13T00:00:00
4
1856
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 not constrained ... Do people write their own classes ? Or have I overlooked one or more intrinsic .NET classes ?
2
3597
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 vertices in that graph to each other. I can see that my hard-drive is working very hard throughout the operation. The operation took about 2 hours (I just canceled it at this point, looked like it was about 10% done) with 200,000 vertices and an...
0
10164
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.