Database design pattern question
- From: Andrew McLean <spam-trap-095@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 17 Jul 2005 19:16:36 +0100
I'm new to database design, I've done some reading and think I have come up with the most natural database schema for my application, but I'm not sure if the approach I'm taking is practical. I would appreciate some advice before ploughing ahead.
I think I have come up with what might be thought of as a design pattern, which I haven't seen before. I may just have looked in the wrong places or it might be a bad idea.
I'll illustrate by very simple hypothetical example with 3 tables.
Person(PersonID, Name) SexEvent(Timestamp, PersonID, Sex) TitleEvent(Timestamp, PersonID, Title)
The idea is that we have a table of people, but we learn information about them, like their sex and title, at later dates when we interact with them. Rather than having columns in the Person table for these attributes, we store tables of "events", one column of which is a timestamp, when we learn this information.
I am considering this approach for two reasons, the first is to maintain an audit trail. But the main reason is it would be extremely helpful for my (unusual) application to be able to run multiple *non-networked* copies of the database. I think that by storing data in these event lists, subsequent synchronisation will be as simple as forming the union of multiple copies of the relevant event tables.
What I'm not sure about is the efficiency of this approach. The data is all there, but can we efficiently perform the required queries?
Take the following task. "List all the people and the most up to date information we have on their sex and title". Is it possible to construct an SQL query which returns such a table of (Name, Sex, Title)? Or do I have to loop over each person in the Person Table and construct queries to extract their Sex and Titles one at a time?
Any suggestions gratefully received.
-- Andrew McLean .
- Follow-Ups:
- Re: Database design pattern question
- From: --CELKO--
- Re: Database design pattern question
- From: Stefan Rybacki
- Re: Database design pattern question
- From: jerry gitomer
- Re: Database design pattern question
- Prev by Date: Re: untypical problem
- Next by Date: Re: Database design pattern question
- Previous by thread: untypical problem
- Next by thread: Re: Database design pattern question
- Index(es):
Relevant Pages
|