If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > How to add an extra element to my erd?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-10, 03:07
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
How to add an extra element to my erd?

Hello,

I have an access database which is used to store individual users (tblusers) visits (tblvisits) to a library. One user can have many visits, and one visit may involve many activities (tlbactivities).

I would like to add the option of allowing a Group of people (tblgroups) to make a visit to a library, but the part which I cannot get right is that an existing individual user may be a member of many groups, and one group may have many members. So if an individual comes for a visit with a group I need to capture that group visit, but also the induvidual user who was part of that group.

I am not sure how to add a possible groups table, should it be related to tblusers, or tblgroups, or both? I have attached my erd if anyone can offer any suggestions.

Thank you
Attached Thumbnails
How to add an extra element to my erd?-erd2.jpg  
Reply With Quote
  #2 (permalink)  
Old 04-14-10, 13:20
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Any thoughts or suggestions?
Reply With Quote
  #3 (permalink)  
Old 04-14-10, 13:59
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
so a person can visit the library in their own capacity or as a member of a group, presumably you don't know if all members of a group will visit the library in the same visit.

so it sounds like you need intersection tables to associate which groups a member belongs to
that intersection is usually the PK of the intersecting tables combining to form the PK of the intersected table

the you need intersection tables between a visit and individuals. arguably you could store the group as part of the visit table as there can only be one group in any one visit
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #4 (permalink)  
Old 04-14-10, 15:54
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Quote:
so a person can visit the library in their own capacity or as a member of a group, presumably you don't know if all members of a group will visit the library in the same visit.
Yes that is correct.

So am I correct in thinking I should create an intersection table between tblusers and tblgroups, using userID(pk) and groupID(pk) from the two table as the new intersection tables primary keys?

And yes, one group can make one visit at a time.

And then, is the new intersection table (lets say it is called 'tblBelongsTo') linked to my existing visits table?

It is getting me so confused!
Reply With Quote
  #5 (permalink)  
Old 04-14-10, 17:39
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Could you explain again how many intersection tables I need, and where and to they are joining to?
Reply With Quote
  #6 (permalink)  
Old 04-15-10, 03:19
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
an intersection table is used when you need to model a many to many relationship

Google
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #7 (permalink)  
Old 04-15-10, 03:35
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Yes, do I need one or two intersection tables?

Firstly, an intersection table between groups and indivials? This new intersection table links to the visits table? Is that correct?

And then secondly an intersection table between visits and individuals? This intersection table also then links to visits table Is that correct?
Reply With Quote
  #8 (permalink)  
Old 04-15-10, 11:46
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Am I on the right track with this new ERD? If you could have a look and let me know I would appreciate it very much
Attached Thumbnails
How to add an extra element to my erd?-erd3.jpg  
Reply With Quote
  #9 (permalink)  
Old 04-15-10, 15:00
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I don't think you need to separate visit and beneficiaryVisit, because they are they describe the same thing.
Reply With Quote
  #10 (permalink)  
Old 04-15-10, 15:00
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Some thunklations:
Is a beneficiary what was once a user? If so, can a user visit if they are not in a group?

Imagine tblBeneficiaryGroups contains one row and one row only:
Code:
1     1
And tblBeneficiaryGroupVisits contains one row and one row only:
Code:
2     2     2
would that be valid?

If a beneficiarygroup visits more than once do you need to record all visits?
Reply With Quote
  #11 (permalink)  
Old 04-15-10, 15:21
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Sorry, yes a Beneficiary is a User, call them what you want, I forgot I may have changed that field name.

Yes a User can visit when not in a group.

All visits by an individual need to be recorded, and all visits by a group need to be recorded also.

I have just realised that I may not have explained the group visit clearly, and this may confuse things more, but I need to mention it: One user can visit as a representetive of a whole group. What I mean is a Group visit may infact only have had one User making that visit on behalf of a group. (A group visit may be defined by a single user arriving at a library on behalf of a group to do photocopying for that group)

Now my head really hurts!

Last edited by moss2076; 04-15-10 at 15:28.
Reply With Quote
  #12 (permalink)  
Old 04-15-10, 15:29
DevilsAdvocate DevilsAdvocate is offline
Registered User
 
Join Date: Apr 2010
Posts: 24
Quote:
Originally Posted by moss2076 View Post
I have just realised that I may not have explained the group visit clearly, and this may confuse things more, but I need to mention it: One user can visit as a representetive of a whole group. What I mean is a Group visit may infact only have had one User making that visit.
I wouldn't worry about that. If they are acting as a single rep for a group, count them as a group, since they arn't there on a single user capacity.

Just my 2 cents
__________________
DevilsAdvocate
------------------------
The elephant in the room
------------------------
Ordo ab chao
Reply With Quote
  #13 (permalink)  
Old 04-15-10, 15:44
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Quote:
Originally Posted by DevilsAdvocate View Post
I wouldn't worry about that. If they are acting as a single rep for a group, count them as a group, since they arn't there on a single user capacity.

Just my 2 cents
Thankyou for your input
Reply With Quote
  #14 (permalink)  
Old 04-15-10, 16:56
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by moss2076 View Post
Yes a User can visit when not in a group.
Ok - so which table would you record this in?

The other questions still stand too

Quote:
Originally Posted by moss2076 View Post
Now my head really hurts!
Jolly good - that means things are going swimmingly.
Reply With Quote
  #15 (permalink)  
Old 04-15-10, 17:11
moss2076 moss2076 is offline
Registered User
 
Join Date: Aug 2004
Posts: 344
Quote:
Originally Posted by pootle flump View Post
Ok - so which table would you record this in?
I think I would record this in the single visits table, and have a field to show wether the visit was part of a group or not? A yes/no combo field.

In response to your other question -
Quote:
Imagine tblBeneficiaryGroups contains one row and one row only:

Code
1 1
And tblBeneficiaryGroupVisits contains one row and one row only:

Code:
2 2 2
would that be valid?

If a beneficiarygroup visits more than once do you need to record all visits?
yes I think that would be valid and yes I need to record all visits.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On