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 trialCody Stephenson
8,361 PointsMy overly explicit solution starting from a different table.
Just in case anybody wanted to see a different solution that starts from a different table. I tend to over-define table.column combo for the sake of being explicit, so some things may be unnecessary or redundant.
SELECT c.period_id AS "Period", sub.name, t.first_name||" "|| t.last_name AS "Teacher", c.room_id AS "Room #"
FROM classes as "c"
JOIN schedule AS "s"
ON c.id = s.class_id
JOIN periods AS "p"
ON c.period_id = p.id
JOIN students as "stu"
ON s.student_id = stu.id
JOIN subjects AS "sub"
ON c.subject_id = sub.id
JOIN teachers AS "t"
ON c.teacher_id = t.id
WHERE stu.first_name = 'Rex' AND stu.last_name = 'Rios'
ORDER BY period_id ASC;