Calculating cost per square foot
Question
You're given the following tables that have information about a real estate portfolio. The tables provide information on building size and total cost.
Table: building_info
building_id | sqft | num_rooms | num_bathrooms |
---|---|---|---|
1 | 40073 | 40 | 10 |
2 | 98003 | 98 | 25 |
3 | 12092 | 12 | 3 |
... | ... | ... | ... |
Table: building_cost
building_id | rent | janitorial |
---|---|---|
1 | 184314 | 2654 |
2 | 65486 | 1372 |
3 | 52891 | 2145 |
... | ... | ... |
Using the tables above, write a SQL query that calculates the average total cost per square foot for each building. In the "building_cost" table you'll have to add both the rent and the janitorial cost in order to calculate total cost.
You can view/query the data in an interactive SQL fiddle here.