Weather Observation Station 15

Query the Western Longitude (LONG_W) for the largest Northern Latitude (LAT_N) in STATION that is less than . Round your answer to decimal places.

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.

Analysis

This question asks for the longitude of the largest latitude in station table having latitude less than 137.2345. We will have the table

  • select round(long_w, 4)

  • from station

  • where lat_n = (select max(lat_n) from station where lat_n < 137.2345 ORDER BY LAT_N DESC )

Note:

when using max, the order of the table is not important; when suing limit, the order of the list will matter as the limit/top select from the top of the list

Query

/*QUERY 1*/
SELECT ROUND(LONG_W, 4) FROM STATION WHERE LAT_N = (SELECT MAX(LAT_N) FROM STATION WHERE LAT_N < 137.2345)

/*QUERY 2*/
SELECT ROUND(LONG_W, 4) FROM STATION WHERE LAT_N < 137.2345 ORDER BY LAT_N DESC LIMIT 1;

Last updated