You have not mentioned who is responsible of doing this. First try to outline the user task of the person that does this and the information structure where the teacher sits in. Are teachers part of a certain subject ? How many teachers have the same subject? Are teachers part of multiple subjects?
Assuming there are less teachers than students I would create another view, like a teacher's students views and in there with a dropdown with search I would add the students of the particular teacher.
Or a subject view, maybe cards for each subjects, inside of the subjects the teachers and under teachers the students.
Just map out the data and see what would be the easiest way. Because instead of associating a teacher for each individual students, let's say you have 50 students / 5 teachers. It would be easier to go to each 5 teachers and associate a number of students.