Design-Many-to-Many
create intermediary table with ids of both tables
class table
id | class_name |
---|---|
5 | Math |
9 | Art |
2 | Science |
intermediary table
id | class_id |
---|---|
5 | 5 |
2 | 9 |
3 | 5 |
4 | 2 |
1 | 9 |
student table
id | student_name |
---|---|
5 | John |
4 | Joe |
7 | Paul |
Backlinks
create intermediary table with ids of both tables
class table
id | class_name |
---|---|
5 | Math |
9 | Art |
2 | Science |
id | class_id |
---|---|
5 | 5 |
2 | 9 |
3 | 5 |
4 | 2 |
1 | 9 |
student table
id | student_name |
---|---|
5 | John |
4 | Joe |
7 | Paul |