-
-
Save voltgister/30b1ee262dd88910eb47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Which regions have the highest density of devices? | |
-- Returns the top 5 regions and devices per m^2. | |
select r.id, count(*) / area(r.border) as device_density | |
from devices as d | |
inner join regions as r | |
on contains(r.border, d.location) | |
group by r.id | |
order by device_density desc | |
limit 5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment