#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    How to make a databse for scheduling?


    Im totally new to MySQL and I have an assignment which is about designing a database for scheduling. This system must allocate students and staff to a suitable class room. The problems is there are many students in a class, so how could the class refer to them? What's the relationship between these tables: class_room, student and staff? Can anyone show me a way to solve it?
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,166
    Rep Power
    4274
    Originally Posted by clonevn
    The problems is there are many students in a class, so how could the class refer to them?
    it cannot

    the student must refer to the class

    this is accomplished with a foreign key

    in any one-to-many relationship, the foreign key resides in the "many" table, and references the primary (or unique) key of the "one" table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0
    OK, thanks a lot. I will try another way.
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,166
    Rep Power
    4274
    Originally Posted by clonevn
    OK, thanks a lot. I will try another way.
    yes, have the student refer to the class
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo