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 > Database Server Software > MySQL > More than one "many-to-many" relations...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-10, 19:39
db-student db-student is offline
Registered User
 
Join Date: Apr 2010
Posts: 2
More than one "many-to-many" relations...

I am trying to create a database and i couldn't figure out how to design my tables.
- I have customers in which many of them operates more than one State in the US.
- Each customer also may operate more than one "Operation Type" (in my case there are 5 different operation type available in "table type".
- So to summarize; there are customers operating more than 1 type in more than 1 state. Everything is many-to-many.

For example; in case of 3 tables (customer, type and state), If a customer operates in 3 different operation in 50 states, do i need to enter 150 rows for one customer?
Can anyone give me a start point how to design my tables and relations?
Reply With Quote
  #2 (permalink)  
Old 04-04-10, 20:03
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
tables needed:

customers (one row per customer)
types (one row per type)
states (one row per state)

customer_types (one row per type per customer)
customer_states (one row per state per customer)
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-04-10, 20:19
db-student db-student is offline
Registered User
 
Join Date: Apr 2010
Posts: 2
Thank you r937! You made my day
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