Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 버퍼
- 클라이언트
- lv2
- 프로그래머스 풀이
- 프로그래머스
- 백준 N과 M 자바
- 프로그래머스 자바
- Stack
- 자바
- 큐
- lv0
- index of
- 프로그래머스 문자열 정렬
- java
- 오름차순 정렬
- Queue
- StringTokenizer
- Programmers
- 스프링부트 도커로 배포
- 스프링부트 도커
- 이진수 변환
- COS Pro
- 스택
- 백준
- 문자열
- 스프링부트 도커 배포
- 삼각형의 완성조건
- SWEA
- Lv1
- 알고리즘
Archives
- Today
- Total
mun dev
[HackerRank] Top Earners 오라클 풀이 본문
문제링크
Top Earners | HackerRank
Find the maximum amount of money earned by any employee, as well as the number of top earners (people who have earned this amount).
www.hackerrank.com
풀이
1. 급여와 월을 곱한 최댓값을 구하고, 해당 값에 대한 카운트도 구한다.
2. 급여와 월을 곱한 갑으로 그룹화 해주고
3. 최댓값을 가장 큰 순으로 정렬해준다.
4. rownum을 사용해 가장 상위에 있는 즉, 가장 큰 값 하나를 조회한다.
코드
select *
from(
select max(salary * months) as max_salary, count(salary * months)
from employee
group by months * salary
order by max_salary desc
)
where rownum <= 1;
'알고리즘 > HackerRank' 카테고리의 다른 글
[HackerRank] Weather Observation Station 20 오라클 풀이 (0) | 2024.01.31 |
---|---|
[HackerRank] Weather Observation Station 15 오라클 풀이 (1) | 2024.01.30 |
[HackerRank] The Blunder 오라클 풀이 (1) | 2024.01.30 |
[HackerRank] Japan Population 오라클 풀이 (0) | 2024.01.30 |
[HackerRank] Average Population 오라클 풀이 (0) | 2024.01.30 |