| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 재귀함수
- for문
- 자바스크립트
- 배열
- array.push()
- Programmers
- Where
- 역행자
- 코딩공부
- Algorithms
- 블록체인
- node.js
- select
- Hackerrank
- array
- SQL
- 정규표현식
- Developer_JoyKim
- 프로그래머스
- 코드스테이츠
- 알고리즘
- 개발자의 책장
- array.slice()
- MySQL
- 코딩테스트
- 개발자_조이킴
- join
- JavaScript
- 코플릿
- 최강의 인생
- Today
- Total
CodingSpace
[HackerRank/SQL] Aggregation - Weather Observation Station 20 본문
[HackerRank/SQL] Aggregation - Weather Observation Station 20
개발자_조이킴 2022. 8. 4. 09:15Problem. Basic Select - Weather Observation Station 20
Link.
https://www.hackerrank.com/challenges/weather-observation-station-20/problem?isFullScreen=true
Weather Observation Station 20 | HackerRank
Query the median of Northern Latitudes in STATION and round to 4 decimal places.
www.hackerrank.com
Description.
A median is defined as a number separating the higher half of a data set from the lower half.
Query the median of the Northern Latitudes (LAT_N) from STATION and round your answer to 4 decimal places.

Key Point.
SET,
ROUND,
AVG,
FLOOR,
CEIL,
My Answer.
SET @rowIndex=-1;
SELECT
ROUND(AVG(SS.LAT_N), 4)
FROM
(
SELECT
@rowIndex:=@rowIndex+1 AS rowNumber,
LAT_N
FROM STATION
ORDER BY LAT_N
) SS
WHERE SS.rowNumber IN (FLOOR(@rowIndex / 2), CEIL(@rowIndex / 2));
References.
앎의 공간: https://techblog-history-younghunjo1.tistory.com/160
[SQL] MySQL로 중앙값(Median) 찾아내기 - (HackerRank - Weather Observation Station 20 문제)
🔊 본 포스팅에서 사용되는 테이블의 자료와 출처는 HackerRank 임을 밝힙니다. 더 다양한 SQL 문제를 풀어보시려면HackerRank 사이트를 방문해 보세요! 이번 포스팅에서는 MySQL을 활용해 Median값을 출
techblog-history-younghunjo1.tistory.com
'HackerRank > SQL' 카테고리의 다른 글
| [HackerRank/SQL] Aggregation - Weather Observation Station 18 (0) | 2022.08.02 |
|---|---|
| [HackerRank/SQL] Aggregation - Weather Observation Station 17 (0) | 2022.08.02 |
| [HackerRank/SQL] Aggregation - Weather Observation Station 15 (0) | 2022.08.01 |
| [HackerRank/SQL] Aggregation - Weather Observation Station 14 (0) | 2022.08.01 |
| [HackerRank/SQL] Aggregation - Weather Observation Station 13 (0) | 2022.07.31 |