Create three tables: student, course, and student_course.
The student_course table must describe a many-to-many relationship between student and course.
The bridge table must have:
student_id
course_id
- a composite primary key on
student_id and course_id
- a foreign key referencing
student(id)
- a foreign key referencing
course(id)
Hints
-
Hint 1
A many-to-many relationship is modeled with a third table.
Here that table is student_course.
-
Hint 2
In student_course you need student_id and course_id.
Each one points to the corresponding main table.
-
Hint 3
To avoid duplicate pairs, the PK is not on a single column.
It must use student_id and course_id together.