Weather Observation Station 18

Sort by

recency

|

2516 Discussions

|

  • + 0 comments
    FOR SQL
    
    SELECT round(abs((MIN(LAT_N)-MAX(LAT_N)+MIN(LONG_W)-MAX(LONG_W))) ,4) from STATION
    
  • + 0 comments

    Oracle sample with cte for readability

    WITH ps AS ( 
        SELECT
            min(lat_n) P1a, 
            min(long_w) P1b, 
            max(lat_n) P2c, 
            max(long_w) P2d 
        FROM station)
    SELECT
        round((p2c -p1a) +(p2d-p1b),4) manhattan_distance
    FROM ps
    ;
    
  • + 0 comments
    • a = MIN(LAT_N)
    • b = MIN(LONG_W)
    • c = MAX(LAT_N)
    • d = MAX(LONG_W)
    • Manhattan Distance = (MAX(LAT_N) - MIN(LAT_N) + MAX(LONG_W) - MIN(LONG_W))

    SELECT round(MAX(LAT_N) - MIN(LAT_N) + MAX(LONG_W) - MIN(LONG_W) ,4) FROM STATION

  • + 0 comments
    • a = MIN(LAT_N)
    • b = MIN(LONG_W)
    • c = MAX(LAT_N)
    • d = MAX(LONG_W)
    • Manhattan Distance: |a-c| + |b-d|
    SELECT
        ROUND(ABS(MIN(LAT_N) - MAX(LAT_N))
              + ABS(MIN(LONG_W) - MAX(LONG_W)), 4)
    FROM STATION
    
  • + 0 comments

    select round( max(LONG_W)- min(LONG_W) + max(lat_n)- min(lat_n),4) from STATION;