[HackerRank] SQL Basic (easy)(5)

2025. 8. 15. 16:37·코딩 테스트/02. SQL

1. Weather Observation Station 13

https://www.hackerrank.com/challenges/weather-observation-station-13/problem?isFullScreen=true

 

Weather Observation Station 13 | HackerRank

Query the sum of Northern Latitudes having values greater than 38.7880 and less than 137.2345, truncated to 4 decimal places.

www.hackerrank.com

SELECT
    TRUNCATE(SUM(LAT_N), 4) AS SUM_LAT
FROM STATION
WHERE LAT_N BETWEEN 38.7880 AND 137.2345

POINT!

TRUNCATE(number, decimals)

: 숫자나 날짜에서 지정한 자리까지 잘라내는(버림하는) 함수
남는 자리는 그대로 버리고, 올림이나 반올림을 하지 않음

 

  • number: 자를 대상 숫자
  • decimals: 남길 소수점 자리 수 (0 또는 음수도 가능)

 

2. Weather Observation Station 14

https://www.hackerrank.com/challenges/weather-observation-station-14/problem?isFullScreen=true

 

Weather Observation Station 14 | HackerRank

Query the greatest value of the Northern Latitudes from STATION that are under 137.2345 and truncated to 4 decimal places.

www.hackerrank.com

Query the greatest value of the Northern Latitudes (LAT_N) from STATION that is less than 137.2345. Truncate your answer to  decimal places.

SELECT
    TRUNCATE(MAX(LAT_N), 4) AS MAX_LAT
FROM 
    STATION
WHERE
    LAT_N < 137.2345

3. Weather Observation Station 15

https://www.hackerrank.com/challenges/weather-observation-station-15/problem?isFullScreen=true

 

Weather Observation Station 15 | HackerRank

Query the Western Longitude for the largest Northern Latitude under 137.2345, rounded to 4 decimal places.

www.hackerrank.com

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.

SELECT
    ROUND(LONG_W, 4) AS LON
FROM 
    STATION
WHERE 
    LAT_N < 137.2345
ORDER BY 
	LAT_N DESC
LIMIT 1;

4. Weather Observation Station 16

https://www.hackerrank.com/challenges/weather-observation-station-16/problem?isFullScreen=true

 

Weather Observation Station 16 | HackerRank

Query the smallest of STATION's Northern Latitudes that is greater than 38.7780, and round to 4 decimal places

www.hackerrank.com

Query the smallest Northern Latitude (LAT_N) from STATION that is greater than 38.7780 . Round your answer to  4 decimal places.

SELECT
    ROUND(MIN(LAT_N), 4) AS MIN_LAT
FROM 
    STATION
WHERE 
    LAT_N > 38.7780

5. Weather Observation Station 17

https://www.hackerrank.com/challenges/weather-observation-station-17/problem?isFullScreen=true

 

Weather Observation Station 17 | HackerRank

Query the Western Longitude for the smallest value of the Northern Latitudes greater than 38.7780 in STATION and round to 4 decimal places.

www.hackerrank.com

Query the Western Longitude (LONG_W)where the smallest Northern Latitude (LAT_N) in STATION is greater than 38.7780. Round your answer to 4 decimal places.

SELECT
    ROUND(LONG_W, 4) AS MIN_LOG
FROM 
    STATION
WHERE 
	LAT_N > 38.7780
ORDER BY  
	LAT_N ASC
LIMIT 1;

'코딩 테스트 > 02. SQL' 카테고리의 다른 글

[Hacker Rank] SQL Basic 'The PADS' (medium)  (3) 2025.08.17
[Hacker Rank] SQL Basic (easy) (6)  (5) 2025.08.16
[HackerRank] SQL Basic (easy)(4)  (2) 2025.08.14
[HackerRank] SQL Basic (easy)(3)  (1) 2025.08.13
[HackerRank] SQL Basic (easy)(2)  (8) 2025.08.13
'코딩 테스트/02. SQL' 카테고리의 다른 글
  • [Hacker Rank] SQL Basic 'The PADS' (medium)
  • [Hacker Rank] SQL Basic (easy) (6)
  • [HackerRank] SQL Basic (easy)(4)
  • [HackerRank] SQL Basic (easy)(3)
Growth DA Log
Growth DA Log
Growth DA Log 님의 블로그 입니다.
  • Growth DA Log
    Growth DA Log님의 블로그
    Growth DA Log
  • 전체
    오늘
    어제
    • 분류 전체보기 (125)
      • TIS_COMPANY (6)
      • 코딩 테스트 (61)
        • 01. Python (3)
        • 02. SQL (58)
      • 데이터 분석 (53)
        • 01. BigQuery (9)
        • 02. GA4 (1)
        • 02-1. GA4를 더 잘 다루기 위한 마케팅 개.. (5)
        • 03. streamlit (5)
        • 04. Git (12)
        • 05. 데이터 엔지니어링 (3)
        • 06. 데이터 모델링 (11)
        • 07. Excel (0)
        • 08. Tableau (4)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    rank
    ROW_NUMBER
    프로그래머스
    코드잇스프린트후기
    쿼리테스트
    이행성
    tableau
    코딩테스트
    코테
    tableaubootcamp
    solvesql
    cross_join
    윈도우함수
    AARRR
    streamlit
    SQL
    DENSE_RANK
    revert
    git
    Reset
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.4
Growth DA Log
[HackerRank] SQL Basic (easy)(5)
상단으로

티스토리툴바