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
- ModelCheckPoint
- Gaimification
- Inventory Optimization
- oracle
- Labor Management System
- eda
- pandas profiling
- 신경쓰기의 기술
- 피그마인디언
- 파이썬
- Product Demand
- ProfileReport
- ABC Analysis
- 프로그래머스
- SKU Consolidation
- leetcode
- kaggle
- 딥러닝
- 데이터분석
- 웨어하우스 보관 최적화
- 코딩테스트연습
- SQL
- 코딩테스트
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- tensorflow
- forecast
- MS SQL Server
- TensorFlowGPU
- HackerRank
- MySQL
Archives
- Today
- Total
오늘도 배운다
Placements / HackerRank, SQL, MySQL 본문
문제
source: HackerRank
You are given three tables: Students, Friends and Packages.
Students contains two columns: ID and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best friend). Packages contains two columns: ID and Salary (offered salary in $ thousands per month).
Write a query to output the names of those students whose best friends got offered a higher salary than them. Names must be ordered by the salary amount offered to the best friends. It is guaranteed that no two students got same salary offer.
제출답안(MySQL)
SELECT s.name
FROM students AS s
LEFT JOIN packages AS my_s ON s.id = my_s.id
LEFT JOIN friends AS f ON s.id = f.id
LEFT JOIN packages AS frd_s ON f.friend_id = frd_s.id
WHERE my_s.salary < frd_s.salary
ORDER BY frd_s.salary
문제 바로가기(MySQL)
728x90
'코딩테스트연습(SQL)' 카테고리의 다른 글
Ollivander's Inventory / HackerRank, SQL, MSS SQL Server (0) | 2023.02.20 |
---|---|
Challenges / HackerRank, SQL, MySQL (0) | 2023.02.18 |
Contest Leaderboard / HackerRank SQL MySQL (0) | 2023.01.10 |
Top Competitors / HackerRank, SQL, MySQL (0) | 2023.01.03 |
New Companies / HackerRank, SQL, MySQL (0) | 2023.01.03 |
Comments