dbTalk Databases Forums  

How to normalise?

comp.databases.ms-access comp.databases.ms-access


Discuss How to normalise? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Mo
 
Posts: n/a

Default Re: How to normalise? - 09-16-2011 , 07:57 AM






OK guys,

Thanks so far for the replies.

I have thought of another scenario which may provide the solution to
problem I face.

What if I don't enforce referential integrity? That would mean I would
be modelling exactly the real life scenarios we are likely to encounter,
with a child not being recruited to the trial, whose parents details we
don't possess (for whatever reason) or who may not have either living
parents etc, etc).

In this case, we have a child table (PK ChildID, FK MotherID, FK
FatherID) a father table (PK FatherID) and a mother table (PK MotherID).
I know there's duplication going on there.

Crucially, if I didn't enforce referential integrity, this would more
closely match what happens in the trial and would allow me to create a
data entry form which exactly matches the paper CRF (case report form).
This is another thing the PI (Principal Investigator) has insisted on.

I know that there are dangers with creating orphan records here, but if
we did regular queries to check all the orphan records, and knew which
ones were meant to be orphan records from the paper CRFs, we could then
investigate those which weren't and hopefully remedy the situation.

I'd really appreciate some input from you as I'm sure they'll be a
thousand and one reasons you'll think of that I shouldn't go down this
route.

TIA

Reply With Quote
  #22  
Old   
Phil
 
Posts: n/a

Default Re: How to normalise? - 09-16-2011 , 08:28 AM






On 16/09/2011 13:57:21, Mo wrote:
Quote:
OK guys,

Thanks so far for the replies.

I have thought of another scenario which may provide the solution to
problem I face.

What if I don't enforce referential integrity? That would mean I would
be modelling exactly the real life scenarios we are likely to encounter,
with a child not being recruited to the trial, whose parents details we
don't possess (for whatever reason) or who may not have either living
parents etc, etc).

In this case, we have a child table (PK ChildID, FK MotherID, FK
FatherID) a father table (PK FatherID) and a mother table (PK MotherID).
I know there's duplication going on there.

Crucially, if I didn't enforce referential integrity, this would more
closely match what happens in the trial and would allow me to create a
data entry form which exactly matches the paper CRF (case report form).
This is another thing the PI (Principal Investigator) has insisted on.

I know that there are dangers with creating orphan records here, but if
we did regular queries to check all the orphan records, and knew which
ones were meant to be orphan records from the paper CRFs, we could then
investigate those which weren't and hopefully remedy the situation.

I'd really appreciate some input from you as I'm sure they'll be a
thousand and one reasons you'll think of that I shouldn't go down this
route.

TIA



Would you like a micky mouse version of what you need to play with. If so, I
will email it to you. What version of Access are you using?

Is your email address as shown in the NG?

Phil

Reply With Quote
  #23  
Old   
Bob Barrows
 
Posts: n/a

Default Re: How to normalise? - 09-16-2011 , 08:29 AM



Mo wrote:
Quote:
OK guys,

Thanks so far for the replies.

I have thought of another scenario which may provide the solution to
problem I face.

What if I don't enforce referential integrity?
How is enforcing referential integrity preventing you from performing your
task?

Quote:
That would mean I would
be modelling exactly the real life scenarios we are likely to
encounter, with a child not being recruited to the trial, whose
parents details we don't possess (for whatever reason) or who may not
have either living parents etc, etc).
Enforcing referential integrity will not prevent this.

Quote:
In this case, we have a child table (PK ChildID, FK MotherID, FK
FatherID) a father table (PK FatherID) and a mother table (PK
MotherID). I know there's duplication going on there.
And that indeed is the problem. This design locks you into this model. You
will never be able to use it for anything else. You might be thinking
"that's not a problem", but failure to normalize prevents you from using
some very basic features of the SQL language. Think about the hoops you will
need to jump through to answer a simple question like, "How many parents
have been entered for each child?"
With the normalized structure we recommended, it's a simple grouping query:

select childid, count(*)
from ChildParent
group by childid

Sure you can probably come up with a query to answer that question with your
proposed design, but it's not going to be anywhere near as simple as the
grouping query.

Quote:
Crucially, if I didn't enforce referential integrity, this would more
closely match what happens in the trial and would allow me to create a
data entry form which exactly matches the paper CRF (case report
form). This is another thing the PI (Principal Investigator) has
insisted on.

Again, nothing in the design we proposed prevents you from adding a child
with no parents. What is prevented is adding a parent that has no person
record. You gain nothing by failing to enforce referential integrity.

I think what we have failed to point out is the need to provide a form to
enter a person record for a parent. In the subform, there should be a "New
Parent" button that launches a modal ParentEntry form to enable the addition
of a Person record for the parent. When this form is closed, the subform
needs to be refreshed to allow the combo box to display the newly entered
Person.


Quote:
I know that there are dangers with creating orphan records here, but
if we did regular queries to check all the orphan records, and knew
which ones were meant to be orphan records from the paper CRFs, we
could then investigate those which weren't and hopefully remedy the
situation.
Recipe for disaster. Believe me.

Quote:
I'd really appreciate some input from you as I'm sure they'll be a
thousand and one reasons you'll think of that I shouldn't go down this
route.

Why use a relational database? It sounds like the PI wants to continue using
the paper form.

Reply With Quote
  #24  
Old   
Mo
 
Posts: n/a

Default Re: How to normalise? - 09-16-2011 , 08:59 AM



Hello Phil,

My email address is visible if you go to the 'source view' of one my
messages.

If you can't find it, just shout.

Many thanks.

Reply With Quote
  #25  
Old   
Bob Barrows
 
Posts: n/a

Default Re: How to normalise? - 09-16-2011 , 09:48 AM



Bob Barrows wrote:
Quote:
I think what we have failed to point out is the need to provide a
form to enter a person record for a parent. In the subform, there
should be a "New Parent" button that launches a modal ParentEntry
form to enable the addition of a Person record for the parent. When
this form is closed, the subform needs to be refreshed to allow the
combo box to display the newly entered Person.

Better yet, when the ParentEntry form is closed, the ID of the new Person
record is automatically entered in the combo box.

Reply With Quote
  #26  
Old   
Mo
 
Posts: n/a

Default Re: How to normalise? - 09-16-2011 , 10:57 AM



On 16/09/2011 15:48, Bob Barrows wrote:
Quote:
Bob Barrows wrote:
I think what we have failed to point out is the need to provide a
form to enter a person record for a parent. In the subform, there
should be a "New Parent" button that launches a modal ParentEntry
form to enable the addition of a Person record for the parent. When
this form is closed, the subform needs to be refreshed to allow the
combo box to display the newly entered Person.

Better yet, when the ParentEntry form is closed, the ID of the new Person
record is automatically entered in the combo box.


Yes, I begin to see how your model would work Bob.

Mo

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.