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 > ER Question involving many-to-many-to-many relationship

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-29-11, 20:01
radioshack radioshack is offline
Registered User
 
Join Date: Apr 2011
Posts: 2
ER Question involving many-to-many-to-many relationship

Hi all:

I was hoping you could help me with an ER question. I have three tables: Users, Regions, and Roles. The relationship between them is as follows:

User can be a member of multiple regions
Regions can house many Users

User can have multiple roles
Roles can be assigned to multiple users

I want to be able to capture the following requirement: User can be part of multiple regions, and users can have different roles for each region. I am not sure how to model this correctly. I was hoping that someone here could help. My attempts to model this have not been successful.

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-29-11, 20:06
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
This sounds like a classroom assignement. I'll be glad to help, but I won't do the work for you.

The key to solving this problem is to break down the entities that you need to track. The physical entities are easy: Users, Regions, and Roles. The hard part is to model the two non-physical entities in your problem, which are the relationships of user to region and user to role. Once you include those relationships, then the answer becomes simple.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 05-01-11, 15:27
radioshack radioshack is offline
Registered User
 
Join Date: Apr 2011
Posts: 2
Hmm.

Well. I am not sure that was quite as helpful as I would have hoped.

I suspect your moral lesson also calls for associative tables, but since User can be part of many regions (and vice versa) and Users can have multiple roles in different regions, I fail to see how an associate entity would be 4nf 'lossless'.

In any case: I was hoping for a sensible response on how to neatly model this ternary problem with some account of the entity sets and and the residual leaf table. No luck.

P.S. If someone silly enough wants to cheat on their homework, which is not the case here, these forums do not seem to be the place to guard against it. It's really a waste of everyone's time.
Reply With Quote
  #4 (permalink)  
Old 05-01-11, 15:40
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by radioshack View Post
... I fail to see how an associate entity would be 4nf 'lossless'.
where did this come from? certainly not pat

Quote:
Originally Posted by radioshack View Post
In any case: I was hoping for a sensible response ...
you ~did~ get a very sensible response

if you cannot utilize pat's answer, that's your problem, innit

Quote:
Originally Posted by radioshack View Post
It's really a waste of everyone's time.
you got that right
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 05-02-11, 16:25
futurity futurity is offline
Registered User
 
Join Date: May 2008
Posts: 270
Quote:
Originally Posted by radioshack View Post
Well. I am not sure that was quite as helpful as I would have hoped.
The level of help you get is generally proportional to the amount of effort you yourself put in and the amount of respect with which you treat the help being offered. A vague "I can't figure this out" gets you a vaguely helpful suggestion like Pat's. Showing some of your unsuccessful modeling attempts gets you more specific advice on how to fix them. A sense of entitlement and an expectation of the answer being served on a silver platter gets you nowhere. All's not lost though: you're always entitled to a full refund if you find the help wanting.

Quote:
I suspect your moral lesson also calls for associative tables ...
You suspect correctly. That alone should be a clue to reconsider your solution in those terms, not simply reject it again.

If you're still interested in assistance, you can help yourself out by showing us how you'd resolve the relationship between Users and Regions. That is the easier of the two relationships to figure out.
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