Database choice for creating two connected tables?

前端 未结 3 1787
借酒劲吻你
借酒劲吻你 2021-01-25 07:24

I have to database tables \"Courses\" and \"Students\".

  • Courses table has columns (\"_id\", \"course_name\", \"course_number\").
  • Student table has column
3条回答
  •  伪装坚强ぢ
    2021-01-25 08:03

    There is m to n relationship between Courses and Students. To map a m to n relationship you need a third table.

    courses_students
    ----------------
    id_student
    id_course
    
    courses
    ----------------
    id_course
    // other fields
    
    students
    ----------------
    id_student
    // other fields
    

提交回复
热议问题