본문 바로가기

728x90

SQL/[HackerRank]

[HackerRank/MySQL] Top Earners 가장 높은 연봉과 이에 해당되는 직원 수 구하기 링크: https://www.hackerrank.com/challenges/earnings-of-employees/problem Top Earners | HackerRank Find the maximum amount of money earned by any employee, as well as the number of top earners (people who have earned this amount). www.hackerrank.com SELECT MAX(salary * months), COUNT(*) FROM employee WHERE(salary * months) = (SELECT MAX(salary * mont.. 더보기
[HackerRank/MySQL] The Blunder 지급받아야 할 월급의 숫자 0이 빠지고 계산되는 상황 발생 (예시: 2006 → 26) 지급받아야 하는 월급 금액과 잘못 지급 받은 금액의 차 구하기(정수값) 링크: https://www.hackerrank.com/challenges/the-blunder/problem The Blunder | HackerRank Query the amount of error in Sam's result, rounded up to the next integer. www.hackerrank.com SELECT CEIL(AVG(salary)- AVG(REPLACE(CONVERT(salary, CHAR), '0', ''))) FROM employees .. 더보기
[HackerRank/MySQL] Population Density Difference 가장 높은 인구수와 가장 낮은 인구수의 차 구하기 링크: https://www.hackerrank.com/challenges/population-density-difference/problem Population Density Difference | HackerRank Query the difference between the maximum and minimum city populations in CITY. www.hackerrank.com SELECT MAX(population) - MIN(population) FROM city SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 FROM: 키워드와 함께 검색하고 싶은.. 더보기
[HackerRank/MySQL] Japan Population 일본의 모든 도시의 인구수 합 구하기 링크: https://www.hackerrank.com/challenges/japan-population/problem Japan Population | HackerRank Query to the sum of the populations of all Japanese cities in CITY. www.hackerrank.com SELECT SUM(population) FROM city WHERE countrycode = 'JPN' SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 FROM: 키워드와 함께 검색하고 싶은 속성이 있는 데이블의 이름을 나열 WHERE: 키워드와 함께 비.. 더보기
[HackerRank/MySQL] Average Population 모든 도시의 평균 인구수 구하기 링크: https://www.hackerrank.com/challenges/average-population/problem Average Population | HackerRank Query the average population of all cities, rounded down to the nearest integer. www.hackerrank.com SELECT ROUND(AVG(population)) FROM city SELECT ROUND(AVG(population), 0) FROM city SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 FROM: 키워드와 함께 검색하고 .. 더보기
[HackerRank/MySQL] Revising Aggregations - Averages California 지역의 평균 인구수 구하기 링크: https://www.hackerrank.com/challenges/revising-aggregations-the-average-function/problem Revising Aggregations - Averages | HackerRank Query the average population of all cities in the District of California. www.hackerrank.com SELECT AVG(population) FROM city WHERE district = 'California' SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 .. 더보기
[HackerRank/MySQL] Revising Aggregations - The Sum Function California 지역의 총 인구수 구하기 링크: https://www.hackerrank.com/challenges/revising-aggregations-sum/problem Revising Aggregations - The Sum Function | HackerRank Query the total population of all cities for in the District of California. www.hackerrank.com SELECT SUM(population) FROM city WHERE district = 'California' SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 FROM: 키워.. 더보기
[HackerRank/MySQL] Revising Aggregations - The Count Function 인구수가 100,000명 이상인 도시의 개수 구하기 링크: https://www.hackerrank.com/challenges/revising-aggregations-the-count-function/problem Revising Aggregations - The Count Function | HackerRank Query the number of cities having populations larger than 100000. www.hackerrank.com SELECT COUNT(*) FROM city WHERE population > 100000 SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열 FROM: 키워.. 더보기

728x90