how many dorms have a TV Lounge?
select count(*) from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'TV Lounge'
what is the total capacity of these dorms?
select sum(t1.student_capacity) from dorm as t1 join has_amenity as t2 on t1.dormid = t2.dormid join dorm_amenity as t3 on t2.amenid = t3.amenid where t3.amenity_name = 'TV Lounge'
how many students are living in these dorms?
select count(*) from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid in (select t3.dormid from has_amenity as t3 join dorm_amenity as t4 on t3.amenid = t4.amenid where t4.amenity_name = 'TV Lounge')
list their first and last names.
select t1.fname, t1.lname from student as t1 join lives_in as t2 on t1.stuid = t2.stuid where t2.dormid in (select t3.dormid from has_amenity as t3 join dorm_amenity as t4 on t3.amenid = t4.amenid where t4.amenity_name = 'TV Lounge')