Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialFrances Angulo
5,311 PointsMy solution returned more results
select DISTINCT teachers.first_name as Teacher_first, teachers.last_name as Teacher_last, students.grade from students join schedule on students.id = schedule.student_id join classes on schedule.class_id = classes.id join teachers on classes.teacher_id = teachers.id where students.grade = 8
You got ~6 teachers and I got many more- what is my query actually returning?
3 Answers
Steven Parker
231,236 PointsThe original question was "Which teachers teach only students in 8th grade?"
I believe this query answers the question "Which teachers teach any students in 8th grade?"
Frances Angulo
5,311 Pointsahhhhh that makes sense. Thank you!
Sumiya Malik
3,976 Points-- Which teachers teach only students in 8th grade
SELECT distinct TEACHERS.First_name, Teachers.Last_name
FROM Teachers JOIN
Classes ON Teachers.ID = Classes.Teacher_ID
JOIN Subjects
ON Subjects.ID = Classes.Subject_ID
where subjects.grade=8
order by First_name, Last_name