일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 역행자
- 블록체인
- 재귀함수
- Algorithms
- array
- 코딩테스트
- 자바스크립트
- Hackerrank
- Programmers
- select
- 코플릿
- 알고리즘
- array.slice()
- SQL
- 최강의 인생
- 개발자_조이킴
- node.js
- Developer_JoyKim
- MySQL
- for문
- 정규표현식
- JavaScript
- Where
- 코딩공부
- 배열
- join
- array.push()
- 프로그래머스
- 코드스테이츠
- 개발자의 책장
Archives
- Today
- Total
CodingSpace
[HackerRank/SQL] Aggregation - Weather Observation Station 20 본문
HackerRank/SQL
[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
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
'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 |
Comments