Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Newbie's Q: Many to many relationship

    Hi. I'm designing essentially my first semi complicated (least from my standpoint) database and had a couple questions. It's a listing of parenting classes offered by various organizations around my town, and I'm using (and learning) MySQL.

    I'm having a hard time really understanding how to go about one aspect of this. I have a number of organizations, each with one or more classes, and each class has one or more topics it deals with, such as parenting teens, or parenting after a divorce. So far I have four tables:

    organizations: org_id(PK), org_name, org description, org_address, etc...
    classes: class_id(PK), org_id, class_name, class_description, class_cost, etc...
    class_types: type_id(PK), category

    I'm pretty clear on the relationship between the orgs and classes. Just a one to one relationship right?

    I'm struggling with setting up the relationship between the class and the categories it belongs to. Can anyone give me any pointers? I understand you usually set up a fourth table right? It would have just the two other primary keys like this: classes_class_types: class_id(PK) and type_id(PK) right?

    I know this is probably simple, but I'm still just learning.

    Thanks for the help.

  2. #2
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606
    Quote Originally Posted by brillo
    classes_class_types: class_id(PK) and type_id(PK) right?
    Right.

    And I have to make my reply at least ten characters, hence this sentence.
    Thanks,

    Matt

  3. #3
    Join Date
    Aug 2004
    Posts
    17
    I'm pretty clear on the relationship between the orgs and classes. Just a one to one relationship right?
    Isn't it a one-to-many relationship?

Posting Permissions

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