List all the 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
How many of them have more than 3 bedrooms?
select count(*) from apartment_facilities as t1 join apartments as t2 on t1.apt_id = t2.apt_id where t2.bedroom_count > 3
Show the facility codes of those where there are more than 4 bedrooms.
select t1.facility_code from apartment_facilities as t1 join apartments as t2 on t1.apt_id = t2.apt_id where t2.bedroom_count > 4