본문 바로가기

SQL/HackerRank

[SQL] HarkerLank: Top Earners

문제

 

We define an employee's total earnings to be their monthly salary  X months  worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as 2 space-separated integers. 

 

 

풀이1) GROUP BY + ORDER BY + LIMIT 이용

 

 

 

풀이2) WHERE절 서브쿼리 이용

 

 

풀이3) HAVING절 서브쿼 이용

 

 

 

'SQL > HackerRank' 카테고리의 다른 글

[SQL] HackerRank: Weather Observation Station 6  (0) 2023.06.28
[SQL] HackerLank : Challenges  (0) 2023.06.10
[SQL] HackerRank: Symmetric Pairs  (0) 2023.06.01
[SQL] HackerRank: INNER JOIN 문제  (0) 2023.05.31
[SQL] HakerRank: The Report  (0) 2023.05.31