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 trial

Databases

Tatia Burdett
Tatia Burdett
1,470 Points

My Solution...

   SELECT sj.name AS 'Class Name', rm.capacity, rm.id FROM rooms AS rm
  JOIN classes AS cl ON rm.id = cl.room_id
  JOIN subjects AS sj ON cl.subject_id = sj.id
  WHERE rm.capacity = (SELECT capacity FROM rooms ORDER BY capacity DESC LIMIT 1)
  GROUP BY sj.name;

I haven't seen many solutions that took this approach. It works though... lol

Thoughts for discussion?

1 Answer

ivana kantnerova
ivana kantnerova
15,932 Points

SELECT max(capacity) FROM rooms ... maybe this subquery would be faster