Create a trigger before update that connects the class teacher and their department to the sub teacher and their department and if they dont have the same department raise an error
Teacher Table: tID, ClassteacherNo , subteacherNo (both FK of staffNo)
Staff Table: StaffNo, department
Using Oracle 18c
tried using a join but didnt know how to find the common department between the class teacher and sub
You need no INNER JOIN, you can use :new, to get the staff number and from that you can get the department
fiddle