Hi.
long time no use English explaining the sql query.
Let's starts!
https://www.hackerrank.com/challenges/placements/problem?isFullScreen=true
Placements | HackerRank
Write a query to output the names of those students whose best friends got offered a higher salary than them.
www.hackerrank.com
First of all, I will explain this question.
Summarize the question :
even if this question's difficulty is medium, but it is not that hard.
we just gain the studenst's name who got a less salary than friend.
it is so cruel.. right..?
so, there is 3 simple table.
let's see which cloum contained in each table.
there are name, Id, friend_id and etc.. please see the below.
so, the result must be like this.
it should be ordered by friend salary and should not contain the name who get more salary than friend.
For solving this problem, we should use join and compared the amount of salary between friend and student.
so, my query is like that.
is it so simple right?
I just make the temporary table by using 'with' claues and then use 'join' clause.
and then compared the salary by using 'where' clause.
and them, just completed it right away. hahaha
'열정가득한 개발자의 이야기 > hacker Rank SQL 문제' 카테고리의 다른 글
HackerRank SQL Project Planning (0) | 2024.03.21 |
---|---|
Hacker Rank (The Report) (0) | 2024.03.12 |
Weather observation station 19 (0) | 2024.03.11 |
Weather observation station 20 (0) | 2024.03.11 |
Hacker Rank (Mysql) Basic (0) | 2024.02.28 |