Results 1 to 3 of 3

Thread: Database Newbie

  1. #1
    Join Date
    Nov 2010

    Question Unanswered: Database Newbie

    Hi guys, I'm obviously new - I'm trying to get my head around foreign keys and primary keys as part of a database course I'm on. The information the lecturer is giving isn't going through though

    I have a table defined as thus:

    "STAC runs a variety of classes. Each class has a subject (e.g. “Tin Whistle”) and a level (Beginners,Intermediate or Advanced). Each class is attended by a group of students. Each class can accommodate a certain number of students depending on the nature of the activity, but each student can be involved in any number of classes. In addition, the database needs to record the date a student has joined a class.
    A class is delivered by one tutor. Tutors can teach any number of classes."

    I then have table data that has to be organised:

    ClassID, Name, Level, Start Date, Finish Date, TutorID, NAme,
    ClassID, StudentID, Name, Join Date

    I think:
    ClassID, Name, Level, Start Date, Finish Date
    TutorID, NAme,
    Constitute two of the tables, but I'm not sure about what's left. Class ID and Tutor ID must be the primary keys there as they are unique id's but I'm sure there are two more tables to come because I must need a foreign key somewhere. I'm just not seeing it..

    Any help would be much appreciated!

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    it's clear from the assignment that students and classes are in a many-to-many relationship

    just do a bit of googling and see if you can find any information on the many-to-many relationship

    once you see how that's done, you'll know where the foreign keys go | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2007
    Maitland NSW,Australia
    Also search for Normalization.

Posting Permissions

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