1
I am doubtful whether or not I am doing the right thing in setting up this bank. They could help if the way is right or wrong. For now I just put id in the tables.
Gang
Turma | Turmaid
A 1
B 2
C 3
D 4
Municipality
Municipio | municipioid
municipioA 1
municipioB 2
municipioC 3
municipioD 4
Professor
Professor | turmaid | municipioid
José 3 1
Maria 2 2
Allna 4 3
Pupil
Nome | turmaid | municipioid | ano_ensino
Joao 1 1 1º
Cezar 2 2 7º
Thiago 2 3 5º
I am doubtful because a student may have several teachers or only one, just as the teacher will have several students. I need the teacher to list his students. And that in admin I know which teachers that student has.
This is called n:n relationship, or actually, a teacher can have 0:n students, just as a student can have 0:n teachers, at the beginning of the semester, when students have not yet been allocated in classrooms, for example
– MarceloBoni
You should create an auxiliary table,
aluno_professor
, where to store theid_aluno
asfk
, theid_professor
also asfk
, andid_aluno_professor
being thepk
.– MarceloBoni
@Marcelobonifazio I started to do this but I thought I was wrong then I stopped.
– Thalles Daniel
No, that’s right, inside the table
aluno_professor
you may also have other attributes, such asid_sala
,id_turma
, and etc... it varies from the scope of your problem– MarceloBoni
But both are related by id of the class, what’s the problem ?
– Edilson
@Marcelobonifazio would be like I asked the question?
– Thalles Daniel
last doubt rsrsr @Marcelobonifazio when I will popular the tables I will need popular at the same time this teacher relacao_correct student?
– Thalles Daniel