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 trialGyörgy Varga
19,198 PointsWasn't the question: 'Which subjects are taught in the largest room?'
Hi!
Check out my solution for the task above:
SELECT subjects.name FROM subjects
INNER JOIN classes ON subjects.id = classes.subject_id
INNER JOIN rooms ON classes.subject_id = rooms.id
WHERE rooms.id = (SELECT id FROM rooms WHERE rooms.capacity
= (SELECT MAX(rooms.capacity) FROM rooms)) GROUP BY subjects.name;
I think this is the correct solution for this task. Can you please check it?
1 Answer
Ben Deitch
Treehouse TeacherHey György!
Great job using a subquery to figure out the largest room (rather than hardcoding it like I did)! But you've got one of your joins wrong. On your 2nd join, you're joining a SUBJECT_ID to a ROOM_ID when you want to be doing ROOM_ID to ROOM_ID:
INNER JOIN rooms ON classes.room_id = rooms.id
Hope that helps!
György Varga
19,198 PointsGyörgy Varga
19,198 PointsOhh thank you! I meant to join that... I was carless.