본문 바로가기

For workingHoliday/SQL

Hacker Rank Join and aggregation methon

I will explain about 2 question about Join and aggregation throuhg hacker rank.

 

first of all, this problem should be used  join (or use sub query in where)

 

To summarize question : it should be output the names of all cities where the continent is 'Africa'

 

 before checking the answer, please reading the statment. 

 

for solving this problem, I mentioned before, we can use join statement or sub query.

if you use sub query in where, it will be making the table like using join table. 

 

so I wrote the 2 kind of answer, please check my answer and think this is the perfect answer or not.

I think it is...😝

 

 

 

second of all,

this question should be used aggregation method.

 

To summarize question :

one of the employees couldn't type '0' because the keyboard's key was broken. so there is an issue in monthly salaries. so I have to calculate the amount of error 

 

 

 

for solving this problem, I should  think aboout which method would be perfect. so I choose to use ROUND() and AVG()method.

it is really simple, becaues I solved those problem before, but I don't know how I delete the '0' from origin number.

so I googled and find out, there is 'REPLACE' method in mysql.

so I just use it, and solved perfectly.

 

please check my answer. it is really simple, right?

I think simple is the best. hahaha 😆

 

 

'For workingHoliday > SQL' 카테고리의 다른 글

HackerRank SQL  (0) 2024.02.29