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 > Seeking some opinions on my many-many design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-22-06, 13:22
jason.woollard jason.woollard is offline
Registered User
 
Join Date: Jan 2006
Posts: 1
Question Seeking some opinions on my many-many design

Hi,

I'm writing an e-commerce application and have got my mind in a twist trying to deal with a fairly simple problem... any comments on my proposed solution and ways I could improve it would be greatly appreciated - I have tried going through the steps of normalisation and seem to have created a monster!

Problem:
Each school listing items for sale can relate those items to an Organisational Unit (eg. Year 7; Football Team; HouseA etc.) these OUs can be added / removed at the schools will. In turn the 'users' for each school can belong to the OUs for their school.

Solution:
The bits i'm happy with....
tblStock (pkStockID, Item, Description.....)
tblUsers (pkUserID, Forename,.......fkSchoolID)
tblSchool (pkSchoolID, name, address........)

The proposed mapping of stock & users to organisational units:
tblOrgUnit (pkOU_ID, fkSchoolID, unitName)
tblUser2Org (pkUserID, pkOU_ID) (Joint primary key, foreign keys to 1st tbls)
tblStock2Org (pkStockID, pkOU_ID) (As above)

Whilst this does link them all together, I'm concerned that Many items of stock can belong to many OUs and many users can belong to many OUs - have i dealt with it correctly? Also the tblUser2Org and tblStock2Org will be massive once a few large schools are using the system - is there a better way to deal with large amounts of 'linking' data?

I hope this makes some kind of sense, thanks in advance for any advice or approval.

Kind Regards, Jason Woollard
Reply With Quote
  #2 (permalink)  
Old 01-23-06, 10:43
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
I'm not clear whether you mean that a User should or [b[should not[/b] be linked to many OUs? Certainly your design allows that to happen. If you meant that each User should only be linked to one OU then the design would be:

tblUsers (pkUserID, Forename,.......fkOUlID)

Assuming you want the many-to-many that you have, there is no better way to design it. You don't say what DBMS you will be using, but if the data volumes are "massive" then it better be something robust, in which case handling large data volumes will be a piece of cake.

I would never prefix table names with "tbl" personally. Smells of VB code!
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
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