I have three tables, with these fields:
classes: class_id | name | grade
classes_students: class_id | student_id
students: student_id | name
Classes has a 1:n relationship with Students, so one class can have many students. I want to select all students of a particular class, where class_id is 5.
Could I just do something like this?
SELECT student.name FROM students student
LEFT JOIN classes_students link
ON link.class_id = 5
AND link.student_id = student.student_id
I'm not sure about if I need the join here and if that has to be a "LEFT JOIN"? What I want is only a record set containing the student names.