For student data access separation there is a Teacher Restricted Mode feature is available, by default teachers can access all student data but when Teacher Restricted Mode (System Settings > General Setting > Miscellaneous > Teacher Restricted Mode) is enabled then teacher can see only their assigned class-section or subject, student related data for different modules like Exam, Homework, Lesson Plan etc.

 
Note:- please note that if you have assigned teacher as a class teacher to the class then this teacher will be able to manage their assigned class related all data like Homework, Timetable etc even course/subject not assigned to this class teacher.

How to assign Subject Teacher -

To assign Subject Teacher you need to create Timetable from Academics > Class Timetable for the class and from here you can choose subject and can assign teacher to those selected subjects.