hdonghun / SQL

1 stars 0 forks source link

SQL 문제 풀기_ HACKER RANK - Weather Observation Station 17 #33

Open hdonghun opened 2 years ago

hdonghun commented 2 years ago

HACKER RANK - Weather Observation Station 17 출처 : https://www.hackerrank.com/challenges/weather-observation-station-17/problem

Query the Western Longitude (LONG_W)where the smallest Northern Latitude (LAT_N) in STATION is greater than 38.7780. Round your answer to decimal places. Input Format The STATION table is described as follows: image

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

hdonghun commented 2 years ago

MYSQL답안 : SELECT ROUND(LONG_W, 4) FROM STATION WHERE LAT_N > 38.7780 ORDER BY LAT_N LIMIT 1

hdonghun commented 2 years ago

MSSQL 답안: SELECT FORMAT(LONG_W, '.0000') FROM STATION WHERE LAT_N = (SELECT MIN(LAT_N) FROM STATION WHERE LAT_N > 38.7780);

FORMAT으로 자릿 수 맞추어 주기!!