题目如下:
Consider and to be two points on a 2D plane.
- happens to equal the minimum value in Northern Latitude (LAT_N in STATION).
- happens to equal the minimum value in Western Longitude (LONG_W in STATION).
- happens to equal the maximum value in Northern Latitude (LAT_N in STATION).
- happens to equal the maximum value in Western Longitude (LONG_W in STATION).
Query the Manhattan Distance between points and and round it to a scale of 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.
解题思路:用max,abs,min,format即可得到答案。
代码如下:
/* Enter your query here. */ select FORMAT(ABS(a-c) + ABS(b-d),4) from (select min(LAT_N) as a, min(LONG_W) as b,max(LAT_N) as c, max(LONG_W) as d from STATION) STA;