Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010

    Unanswered: 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?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    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) | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2010
    Thank you r937! You made my day

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts