🤔 문제 분석
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
'코딩테스트 > 해커랭크 SQL' 카테고리의 다른 글
[해커랭크/SQL] 31. Weather Observation Station 13 (0) | 2023.03.12 |
---|---|
[해커랭크/SQL] 30. Weather Observation Station 2 (0) | 2023.03.12 |
[해커랭크/SQL] 28. The Blunder - replace 함수 (0) | 2023.03.08 |
[해커랭크/SQL] 27. Population Density Difference (0) | 2023.03.07 |
[해커랭크/SQL] 26. Japan Population (0) | 2023.03.07 |
댓글