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 > data modelling advice needed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-09, 06:43
db2hrishy db2hrishy is offline
Registered User
 
Join Date: Jun 2004
Posts: 115
data modelling advice needed

Hi

Need advice on data modelling.

I have a table called consignments which is identified by a cosignment_id .

consignor ,consignee pickup and alertme are all types of roles parties can play within the system .
i,e party can have many roles and roles can belong to many parties.

A given consignment can have a consignor,consignee,pickup etc..

How do i model the relationship between consignment and parties?

regards
Hrishy
Reply With Quote
  #2 (permalink)  
Old 01-28-09, 07:10
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by db2hrishy
How do i model the relationship between consignment and parties?
Normally you'd just add a party_roles table and end up with the following tables :
  • consignments : consignment_id ...
  • parties : party_id ...
  • roles : role_name
  • party_roles : consignment_id, party_id, role_name
This doesn't enforce any party roles are in place for a given consignment - you'd need to add a trigger or use a stored procedure to insert the data and ensure whatever roles that are needed are present. If only one party can have a given role on a consignment then it may be worth moving that entry into the consignments table but it could be argued either way.

The roles table is just to provide a list of valid entries for the role_name being entered. Normally tables are named with a singular name ie consignment rather than consignments. Also it's often better to use capitalisation in table names (ie Consignment and PartyRole) just to make things a little clearer.

Mike
Reply With Quote
  #3 (permalink)  
Old 01-28-09, 10:00
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Quote:
Originally Posted by db2hrishy
Need advice on data modelling.
Make sure you get with a reputable data modeling agency. Not just some sleazy project manner with a Polaroid working out of his basement.
I was so naive....
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
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