Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
-- Which regions have the highest density of devices?
-- Returns the top 5 regions and devices per m^2.
select, count(*) / area(r.border) as device_density
from devices as d
inner join regions as r
on contains(r.border, d.location)
group by
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