Is this Possible?

Hi, Everyone

I have been racking my brain for a couple of days now and I can’t figure this out!

I am developing an interview booking system. The tables I have are:

Parents - id, name, pwd
Students - id, parent_id, student_code, student_name
Enrolments - id, student_id, class_code
classes - id, class_code, subject_code, teacher_code, description
teachers - id, teacher_name

The data I need is:

students.student_name, enrolments.class_code, classes.description, classes.teacher_code, teachers.teacher_name

Can anyone see how I can achieve this???Please…

Assuming that classes.teacher_code refers to teachers.id


SELECT
   students.student_name
 , enrolments.class_code
 , classes.description
 , classes.teacher_code
 , teachers.teacher_name
FROM
   students
INNER JOIN
   enrolments
   ON students.id=enrolments.student_id
INNER JOIN
   classes
   ON enrolments.class_code=classes.class_code
INNER JOIN
   teachers
   ON classes.teacher_code=teachers.id

If classes.teacher_code does not refer to teachers.id it can’t be done with the current tables.