Trouble with creating one to many relationship between tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NicoleCartrette
    New Member
    • Nov 2009
    • 2

    Trouble with creating one to many relationship between tables

    Going back to school is easier said than done..

    This was posted to an older thread earlier but I don't think it got any attention. Your help is appreciated

    Professor requires we create a simple database and specified what are to be the primary keys and relationships etc.
    I have created the four tables and established the neccessary one to many and many to one relationships between primary keys in the tables with the exception of one which tells me the relationship is "indetermin ate" (originally there was no unique index found for the referenced field of the primary table) I am trying to establish the relationship between two primary keys (as instructed).

    Course
    CLassID, pk
    Name
    Credit_Hours
    Catalog_Descrip tion

    (one to many relationship est. between ClassID and ClassID in the next Table)

    ClassOffering
    ClassID,pk
    Section,pk
    Professor
    (More, etc)

    (One to many relationship established okay here between ClassID to ClassID but trying to establish a one to many relationship between Section in the ClassOffering table to the Section in ClassStu table creates new tables "ClassStu_1 , CLassStu_2"in the relationship diagram. What am I doing wrong?

    ClassStu
    CLassID,pk
    Section,pk
    StudentID,pk

    (Many to one relationship created okay here between StudentID and StudentID in next table)

    Student
    StudentID,pk
    Name
    Major
    Class
    GPA
  • ajalwaysus
    Recognized Expert Contributor
    • Jul 2009
    • 266

    #2
    Your tables are not normalized so first thing you need to do is look over this article about Normalization.

    I hope no one else just gives you the answer outright, because that would defeat the purpose of this class you are taking. But I do hope you can find use in this article.

    -AJ

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Once you have read the article please feel free to ask any questions to clarify what you don't understand.

      I would guess based on the structure you have laid out that your instructor is trying to teach you about the use of Join tables to break up a many to many relationship between two tables. However, read the article and see how you get on.

      Mary

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32656

        #4
        I see you haven't returned to respond. This is a shame as that article would be very helpful to you I'm sure.
        Originally posted by NicoleCartrette
        This was posted to an older thread earlier but I don't think it got any attention. Your help is appreciated
        That is one of the main reasons why posting your question in another member's thread is illegal here (See How to Ask a Question). We're not here to teach you manners, but we also need to protect our members from behaviour that is unacceptable.

        Comment

        • NicoleCartrette
          New Member
          • Nov 2009
          • 2

          #5
          I have read the posted material and it is very informative but what I forgot to mention was the table names and fields were determined for us.

          It should be a one to many relationship between the Section in the Class Offering table and section in the Class-Stu table according to his relationship diagram.
          The "section" in the Class-Stu table must also be identified as a primary key. The "section" in the Class-Stu table is set to Yes (Allow duplicates) but I do not understand why it creates new tables (ClassStu_1, ClassStu_2) when his sample relationship diagram shows only a one to many relationship between the two original tables.
          Is it related to referential integrity or cascading? I have tried many different things.

          In response to your statement NeoPa that you are not here to teach people manners I posted my question on an existing thread because I believed my question be closely similar to that posed on the other thread.

          Comment

          • ajalwaysus
            Recognized Expert Contributor
            • Jul 2009
            • 266

            #6
            Originally posted by NicoleCartrette
            I posted my question on an existing thread because I believed my question be closely similar to that posed on the other thread.
            I can understand why you did it, but that rule is there for your benefit as much as the thread owner's benefit. In the short time I have been part of this forum, I have seen many threads transform with the thread owner's needs (which is allowed since it is their thread), and those who post questions on someone else's thread don't get any attention. As you can see from this thread, your issue did not have the same outcome of the other thread you posted your question on, and if it did there would be no need for you to post your question in the first place.

            It's all good, as long as we learn. =)

            Welcome to Bytes.
            -AJ

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32656

              #7
              Originally posted by NicoleCartrette
              In response to your statement NeoPa that you are not here to teach people manners I posted my question on an existing thread because I believed my question be closely similar to that posed on the other thread.
              I'm pleased and a little surprised (perhaps I judged too quickly) that you have returned to respond. Particularly as I thought AJ's post was apposite and should help you.

              As AJ has also explained quite well, it is generally to all parties benefit that new questions be posted in their own thread. Having said that, you are a new poster and it would be unreasonable to expect you either to know all our rules as well as we do, or to have given the matter as much consideration as we have before posting in another thread.

              Welcome to Bytes!

              Comment

              Working...