You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hackerrank/Sql/README.md
+68-11Lines changed: 68 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -179,45 +179,102 @@ LIMIT 1;
179
179
```
180
180
181
181
###Weather Observation Station 15
182
-
182
+
Query the Western Longitude (LONG_W) for the largest Northern Latitude (LAT_N) in STATION that is less than 137.2345. Round your answer to 4 decimal places.
183
183
```sql
184
184
-- mysql
185
-
185
+
SELECT ROUND(LONG_W,4)
186
+
FROM station
187
+
WHERE LAT_N<137.2345
188
+
ORDER BY LAT_NDESC
189
+
LIMIT1;
186
190
```
187
191
188
192
###Weather Observation Station 16
189
-
193
+
Query the smallest Northern Latitude (LAT_N) from STATION that is greater than 38.7880. Round your answer to 4 decimal places.
190
194
```sql
191
195
-- mysql
192
-
196
+
SELECT ROUND(LAT_N,4)
197
+
FROM station
198
+
WHERE LAT_N>38.7880
199
+
ORDER BY LAT_NASC
200
+
LIMIT1;
193
201
```
194
202
195
203
###Weather Observation Station 17
196
-
204
+
Query the Western Longitude (LONG_W) where the smallest Northern Latitude (LAT_N) in STATION that is greater than 38.7880. Round your answer to 4 decimal places.
197
205
```sql
198
206
-- mysql
199
-
207
+
SELECT ROUND(LONG_W,4)
208
+
FROM station
209
+
WHERE LAT_N>38.7880
210
+
ORDER BY LAT_NASC
211
+
LIMIT1;
200
212
```
201
213
202
214
###Weather Observation Station 18
215
+
Consider P1(a, b) and P2(c,d) to be two points on a 2D plane.
216
+
- a - happens to equal the minimum value in Northern Latitude (LAT_N in STATION).
217
+
- b - happens to equal the minimum value in Western Longitude (LONG_W in STATION).
218
+
- c - happens to equal the maximum value in Northern Latitude (LAT_N in STATION).
219
+
- d - happens to equal the maximum value in Western Longitude (LONG_W in STATION).
203
220
221
+
Query the Manhattan Distance between points P1 and P2 and round it to a scale of 4 decimal places.
Consider P1(a, c) and P2(b, d) to be two points on a 2D plane where (a,b) are the respective minimum and maximum values of Northern Latitude (LAT_N) and (c, d) are the respective minimum and maximum values of Western Longitude (LONG_W) in STATION.
235
+
Query the Euclidean Distance between points P1 and P2 and round it to a scale of 4 decimal places.
A median is defined as a number separating the higher half of a data set from the lower half. Query the median of the Northern Latitudes (LAT_N) from STATION and round your answer to 4 decimal places.