Jump to content
Larry Ullman's Book Forums

emilg1984

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by emilg1984

  1. I'm having difficulties understanding how a intermediary table works.

    The example on page 168 makes sense and is simple to understand (the books and authors example), but when I tried to apply it to my design it didn't work out.

     

    This is my intended design: I have a 'users' table. Each user has a course/s that he's taking, 'course_id.' The name of the course is in the 'courses' table, and the intermediary table is 'users_courses.' I want to extract the 'user_id' together with the 'course_name.'

     

    users:
    user_id (pk)

     

    users_courses:
    user_id (pk)
    course_id

     

    courses:

    course_id (pk)
    course_name

     

    Is this the right way to go? It doesn't make sense to me, because I can't enter multiple values for the same user in a case where he's taking more than one course since it's going to create duplicate keys.

    How do I make it work?

×
×
  • Create New...