I would like to know how to insert two ids into two tables. For example, there are 5 tables one is a student, which has the following information:
+--------+------------+
| ID_ALU | nome |
+--------+------------+
| 1 | aluno 1 |
| 2 | aluno 2 |
+--------+------------+
class has the following information:
+--------+------------+
| ID_TUR | nome |
+--------+------------+
| 1 | Turma 1 |
| 2 | Turma 2 |
+--------+------------+
In the subject table you have the following information:
+--------+------------+
| ID_MAT | nome |
+--------+------------+
| 1 | Materia 1 |
| 2 | Materia 2 |
| 3 | Materia 3 |
+--------+------------+
The pupil_turma table that the student together with the class is:
+--------+------------+------------+
| ID | ID_ALU | ID_TUR |
+--------+------------+------------+
| 1 | 1 | 2 |
| 2 | 2 | 1 |
+--------+------------+------------+
In the table, which makes the joining of matter with the class is:
+--------+------------+------------+
| ID | ID_TUR | ID_MAT |
+--------+------------+------------+
| 1 | 1 | 2 |
| 2 | 1 | 3 |
| 3 | 2 | 1 |
+--------+------------+------------+
Now I want SQL to check which class is the student and binds the class material. Example
+-------+---------+---------+
| ID | ID_ALU | ID_MAT |
+-------+---------+---------+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 2 | 3 |
+-------+---------+---------+