What are the buildings with at least one company office?
select * from office_locations as t1 join buildings as t2 on t1.building_id = t2.id join companies as t3 on t1.company_id = t3.id
How many offices do they each have?
select t1.building_id, count(*) from office_locations as t1 join buildings as t2 on t1.building_id = t2.id join companies as t3 on t1.company_id = t3.id group by t1.building_id
Which one has the most?
select * from office_locations as t1 join buildings as t2 on t1.building_id = t2.id join companies as t3 on t1.company_id = t3.id group by t1.building_id order by count(*) desc limit 1
What is its name?
select t2.name from office_locations as t1 join buildings as t2 on t1.building_id = t2.id join companies as t3 on t1.company_id = t3.id group by t1.building_id order by count(*) desc limit 1