Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE close200 AS SELECT
- nyc_subway_stations.name,
- count(DISTINCT nyc_streets.name) count200
- FROM nyc_subway_stations, nyc_streets
- WHERE ST_DWITHIN(nyc_subway_stations.geom, nyc_streets.geom, 200)
- GROUP BY nyc_subway_stations.name
- ORDER BY count200 DESC;
- CREATE TABLE close100 AS SELECT
- nyc_subway_stations.name,
- count(DISTINCT nyc_streets.name) count100
- FROM nyc_subway_stations, nyc_streets
- WHERE ST_DWITHIN(nyc_subway_stations.geom, nyc_streets.geom, 100)
- GROUP BY nyc_subway_stations.name
- ORDER BY count100 DESC;
- CREATE TABLE proxMetro AS SELECT
- close100.name, close100.count100, close200.count200
- FROM close100, close200
- WHERE close100.name = close200.name;
- DROP TABLE close100, close200;
- SELECT * FROM proxMetro;
- SELECT
- nyc_subway_stations.name,
- (SELECT count(DISTINCT nyc_streets.name) count100
- FROM nyc_subway_stations, nyc_streets
- WHERE ST_DWITHIN(nyc_subway_stations.geom, nyc_streets.geom, 100)),
- (SELECT count(DISTINCT nyc_streets.name) count200
- FROM nyc_subway_stations, nyc_streets
- WHERE ST_DWITHIN(nyc_subway_stations.geom, nyc_streets.geom, 200))
- FROM nyc_subway_stations, nyc_streets
- GROUP BY nyc_subway_stations.name
- ORDER BY count100 DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement