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
- 코딩테스트연습
- SQL
- MySQL
- leetcode
- 파이썬
- 프로그래머스
- Gaimification
- HackerRank
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- 피그마인디언
- 코딩테스트
- Labor Management System
- 데이터분석
- TensorFlowGPU
- 신경쓰기의 기술
- ABC Analysis
- eda
- MS SQL Server
- ProfileReport
- ModelCheckPoint
- Inventory Optimization
- Product Demand
- forecast
- kaggle
- oracle
- SKU Consolidation
- 웨어하우스 보관 최적화
- pandas profiling
- tensorflow
- 딥러닝
Archives
- Today
- Total
오늘도 배운다
Top Earners / HackerRank, SQL, MySQL 본문
문제
We define an employee's total earnings to be their monthly salary * 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 space-separated integers.
제출답안(MySQL)
SELECT CONCAT(MAX(te.total_earning),' ', COUNT(te.employee_id))
FROM (SELECT months*salary AS total_earning, employee_id
FROM employee
WHERE months*salary = (SELECT MAX(months*salary) FROM employee)
) AS te
문제 바로가기(MySQL)
728x90
'코딩테스트연습(SQL)' 카테고리의 다른 글
Weather Observation Station 14 / HackerRank, SQL, MySQL (0) | 2022.12.22 |
---|---|
Weather Observation Station 13 / HackerRank, SQL, MySQL (0) | 2022.12.22 |
The Blunder / HackerRank, SQL, MySQL (0) | 2022.12.14 |
The PADS / HackerRank, SQL, MySQL (0) | 2022.12.05 |
Type of Triangle / HackerRank, SQL, MySQL (0) | 2022.12.04 |
Comments