mySQL
[HackerRank] Top Earners
bellhundred
2023. 2. 27. 00:56
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
SELECT salary*months, count(*)
from employee
group by salary*months
order by salary*months desc
limit 1
지금껏 받은 월급의 총합(=소득) 중 제일 많이 받은 사람의 금액, 그리고 그 금액만큼을 받은 사람의 수를 표시하는 문제다.
group by salary*months를 빼먹어서 조금 애먹었던 문제였다.