Snoopy [해커랭크/SQL] 29. Top Earners
코딩테스트/해커랭크 SQL

[해커랭크/SQL] 29. Top Earners

Sooyoon Jeong 2023. 3. 8.

 

🤔 문제 분석

1) Write a query to find the maximum total earnings for all employees

2) as well as the total number of employees who have maximum total earnings.

 

💡 풀이

SELECT months * salary, count(*)
FROM Employee
WHERE months * salary = (SELECT MAX(months * salary) AS max
                         FROM Employee)
GROUP BY months * salary

 

댓글