forked from Weitzman-MUSA-GeoCloud/assignment01
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery14.sql
More file actions
32 lines (29 loc) · 781 Bytes
/
Copy pathquery14.sql
File metadata and controls
32 lines (29 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
Which station is closest to Meyerson Hall?
Your query should return only one line, and only give the station id
(station_id), station name (station_name), and distance (distance) from
Meyerson Hall, rounded to the nearest 50 meters.
*/
-- Enter your SQL query here
SELECT
s.id AS station_id,
s.name AS station_name,
ROUND(
ST_DISTANCE(
s.geog::geography,
ST_SETSRID(
ST_MAKEPOINT(-75.192584, 39.952415),
4326
)::geography
) / 50.0
) * 50 AS distance
FROM indego.station_statuses AS s
ORDER BY
ST_DISTANCE(
s.geog::geography,
ST_SETSRID(
ST_MAKEPOINT(-75.192584, 39.952415),
4326
)::geography
)
LIMIT 1;