List all unique facility codes.
select distinct facility_code from apartment_facilities
List all the apartments and the facility codes of them.
select * from apartment_facilities as t1 join apartments as t2 on t1.apt_id = t2.apt_id
Calculate how many rooms are there for those apartments with facility code "Gym".
select sum(t2.room_count) from apartment_facilities as t1 join apartments as t2 on t1.apt_id = t2.apt_id where t1.facility_code = "Gym"